ProjectList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline">
  6. <a-row :gutter="24">
  7. <a-col :md="6" :sm="8">
  8. <a-form-item label="项目名称">
  9. <a-input placeholder="请输入项目名称" v-model="queryParam.projectName"></a-input>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="6" :sm="8">
  13. <a-form-item label="广告主名称">
  14. <!-- <a-input placeholder="请输入广告主名称" v-model="queryParam.advertiserName"></a-input> -->
  15. <a-select
  16. optionFilterProp="children"
  17. showSearch
  18. :filterOption="filterOption"
  19. v-model="queryParam.advertiserId"
  20. placeholder="请选择广告主名称"
  21. >
  22. <a-select-option :value="item.id" v-for="(item, index) of list" :key="index">
  23. {{ item.name }}
  24. </a-select-option>
  25. </a-select>
  26. </a-form-item>
  27. </a-col>
  28. <template>
  29. <a-col :md="6" :sm="8">
  30. <a-form-item label="运营负责人">
  31. <!-- <a-input placeholder="请输入负责人" v-model="queryParam.responsible"></a-input> -->
  32. <a-select
  33. placeholder="请选择运营负责人"
  34. showSearch
  35. optionFilterProp="children"
  36. style="width: 100%"
  37. :filterOption="filterOption"
  38. v-model="queryParam.responsibleId"
  39. @search="search"
  40. @focus="getAllUserList"
  41. >
  42. <a-select-option
  43. v-for="appModel in options"
  44. :key="appModel.userId + new Date().getTime()"
  45. :value="appModel.userId"
  46. >{{ appModel.realName }}&#12288;&#12288;{{ appModel.roleName }}</a-select-option
  47. >
  48. </a-select>
  49. </a-form-item>
  50. </a-col>
  51. </template>
  52. <template>
  53. <a-col :md="6" :sm="8">
  54. <a-form-item label="设计负责人">
  55. <!-- <a-input placeholder="请输入负责人" v-model="queryParam.responsible"></a-input> -->
  56. <a-select
  57. placeholder="请选择设计负责人"
  58. showSearch
  59. optionFilterProp="children"
  60. style="width: 100%"
  61. :filterOption="filterOption"
  62. v-model="queryParam.designResponsibleId"
  63. @search="search"
  64. @focus="getAllUserList"
  65. >
  66. <a-select-option
  67. v-for="appModel in options"
  68. :key="appModel.userId + new Date().getTime()"
  69. :value="appModel.userId"
  70. >{{ appModel.realName }}&#12288;&#12288;{{ appModel.roleName }}</a-select-option
  71. >
  72. </a-select>
  73. </a-form-item>
  74. </a-col>
  75. <a-col :md="6" :sm="6">
  76. <a-form-item label="行业">
  77. <j-tree-select
  78. v-model="queryParam.industryId"
  79. ref="treeSelect"
  80. placeholder="请选择行业"
  81. dict="sys_category,name,id"
  82. pidField="pid"
  83. pidValue="f5cb2d2d28417b3b65a6dd744bcb9a76"
  84. ></j-tree-select>
  85. </a-form-item>
  86. </a-col>
  87. </template>
  88. <a-col :md="6" :sm="8">
  89. <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
  90. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  91. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  92. <!-- <a @click="handleToggleSearch" style="margin-left: 8px">
  93. {{ toggleSearchStatus ? '收起' : '展开' }}
  94. <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
  95. </a>-->
  96. </span>
  97. </a-col>
  98. </a-row>
  99. </a-form>
  100. </div>
  101. <!-- 操作按钮区域 -->
  102. <!-- <div class="table-operator">
  103. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  104. </div>-->
  105. <!-- table区域-begin -->
  106. <!-- 供应商 -->
  107. <div>
  108. <a-table
  109. ref="table"
  110. size="middle"
  111. bordered
  112. rowKey="id"
  113. :columns="columns"
  114. :dataSource="dataSource"
  115. :pagination="ipagination"
  116. :loading="loading"
  117. @change="handleTableChange"
  118. >
  119. <span slot="maxBid" slot-scope="text">{{ text / 1000 }}</span>
  120. <span slot="maxDeepCpaBid" slot-scope="text">{{ text / 1000 }}</span>
  121. <span slot="ocpxActionType" slot-scope="text">
  122. <div v-if="text">
  123. <span v-for="(item, index) of JSON.parse(text)" :key="index"
  124. >{{ item | ocpxActionType }}{{ index == JSON.parse(text).length - 1 ? '' : ',' }}</span
  125. >
  126. </div>
  127. <div v-else>-</div>
  128. <!-- {{ text | ocpxActionType }} -->
  129. </span>
  130. <span slot="bidType" slot-scope="text">
  131. <div v-if="text && JSON.parse(text).length > 0">
  132. <span v-for="(item, index) of JSON.parse(text)" :key="index"
  133. >{{ item | bidType }}{{ index == JSON.parse(text).length - 1 ? '' : ',' }}</span
  134. >
  135. </div>
  136. <div v-else>-</div>
  137. </span>
  138. <span slot="mediaId" slot-scope="text">
  139. {{ text == '1' || text == '3' ? '头条' : '快手' }}
  140. </span>
  141. <span slot="action" slot-scope="text, record">
  142. <a @click="handleEdit(record)">编辑</a>
  143. <a-divider type="vertical" />
  144. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  145. <a>删除</a>
  146. </a-popconfirm>
  147. <!-- /ctop/project/edit -->
  148. </span>
  149. <span slot="materialShare" slot-scope="text, record">
  150. <a-switch :checked='text==0' @change="onChange(text,record)" :loading="spinning"/>
  151. </span>
  152. </a-table>
  153. </div>
  154. <!-- table区域-end -->
  155. <!-- 表单区域 -->
  156. <project-modal ref="modalForm" @ok="modalFormOk"></project-modal>
  157. </a-card>
  158. </template>
  159. <script>
  160. import ProjectModal from './modules/projectListModal'
  161. import JTreeSelect from '@/components/jeecg/JTreeSelect'
  162. import { httpAction, getAction } from '@/api/manage'
  163. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  164. export default {
  165. name: 'ProjectList',
  166. mixins: [JeecgListMixin],
  167. components: {
  168. ProjectModal,
  169. JTreeSelect,
  170. },
  171. data() {
  172. return {
  173. description: '项目管理页面',
  174. // 表头
  175. columns: [
  176. {
  177. title: '项目名称',
  178. align: 'center',
  179. dataIndex: 'projectName',
  180. },
  181. {
  182. title: '广告主名称',
  183. align: 'center',
  184. dataIndex: 'advertiserId_dictText',
  185. },
  186. {
  187. title: '最高出价',
  188. align: 'center',
  189. dataIndex: 'maxBid',
  190. scopedSlots: {
  191. customRender: 'maxBid',
  192. },
  193. },
  194. {
  195. title: '最高转化出价',
  196. align: 'center',
  197. dataIndex: 'maxDeepCpaBid',
  198. scopedSlots: {
  199. customRender: 'maxDeepCpaBid',
  200. },
  201. },
  202. {
  203. title: '优化目标',
  204. align: 'center',
  205. dataIndex: 'bidType',
  206. scopedSlots: {
  207. customRender: 'bidType',
  208. },
  209. },
  210. {
  211. title: '转化目标',
  212. align: 'center',
  213. dataIndex: 'ocpxActionType',
  214. scopedSlots: {
  215. customRender: 'ocpxActionType',
  216. },
  217. },
  218. {
  219. title: '供应商',
  220. align: 'center',
  221. dataIndex: 'supplierCode_dictText',
  222. },
  223. {
  224. title: '销售',
  225. align: 'center',
  226. dataIndex: 'saleId_dictText',
  227. },
  228. {
  229. title: '运营负责人',
  230. align: 'center',
  231. dataIndex: 'responsibleId_dictText',
  232. },
  233. {
  234. title: '设计负责人',
  235. align: 'center',
  236. dataIndex: 'designResponsibleId_dictText',
  237. },
  238. {
  239. title: '媒体',
  240. align: 'center',
  241. dataIndex: 'mediaId',
  242. scopedSlots: {
  243. customRender: 'mediaId',
  244. },
  245. },
  246. {
  247. title: '是否共享素材',
  248. align: 'center',
  249. dataIndex: 'materialShare',
  250. scopedSlots: {
  251. customRender: 'materialShare',
  252. },
  253. },
  254. {
  255. title: '操作',
  256. dataIndex: 'action',
  257. align: 'center',
  258. scopedSlots: {
  259. customRender: 'action',
  260. },
  261. },
  262. ],
  263. url: {
  264. list: '/ctop/project/list',
  265. delete: '/ctop/project/delete',
  266. deleteBatch: '/ctop/project/deleteBatch',
  267. exportXlsUrl: 'ctop/project/exportXls',
  268. importExcelUrl: 'ctop/project/importExcel',
  269. },
  270. list: [],
  271. options: [],
  272. spinning: false
  273. }
  274. },
  275. filters: {
  276. bidType(sta) {
  277. var data = {
  278. null: '-',
  279. 1: 'CPM',
  280. 2: 'CPC',
  281. 6: 'OCPC',
  282. 10: 'OCPM',
  283. }
  284. return data[sta]
  285. },
  286. ocpxActionType(sta) {
  287. var data = {
  288. null: '-',
  289. 0: '封面点击',
  290. 2: '行为数',
  291. 10: '曝光',
  292. 11: '点击',
  293. 31: '下载完成',
  294. 53: '提交线索',
  295. 180: '激活',
  296. 190: '付费',
  297. 191: '首日ROI',
  298. 348: '有效线索',
  299. 383: '授信',
  300. 384: '完件',
  301. 394: '订单提交',
  302. 324: '唤起应用',
  303. 715: '微信复制优化目标',
  304. 716: '多转化事件',
  305. 396:'注册优化目标',
  306. 731:'广告观看5次',
  307. 732:'广告观看10次',
  308. }
  309. return data[sta]
  310. },
  311. },
  312. computed: {
  313. importExcelUrl: function () {
  314. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
  315. },
  316. },
  317. methods: {
  318. onChange(text,record) {
  319. this.spinning=true;
  320. console.log(text,record)
  321. let materialShare=text==1?0:1;
  322. httpAction(`/ctop/project/edit`,{
  323. id:record.id,
  324. materialShare
  325. },'put').then((res)=>{
  326. if(res.success) {
  327. this.spinning=false;
  328. this.$message.success('修改成功')
  329. this.modalFormOk()
  330. }else {
  331. this.spinning=false;
  332. this.$message.success(res.message)
  333. this.modalFormOk()
  334. }
  335. })
  336. },
  337. getList() {
  338. var params = {}
  339. // params.userId = this.userInfo().id
  340. params.pageSize = 1000
  341. params.pageNo = 1
  342. getAction('/ctop/advertiser/list', params)
  343. .then((res) => {
  344. if (res.success) {
  345. this.list = res.result.records
  346. } else {
  347. this.$message.warning(res.message)
  348. }
  349. })
  350. .finally(() => {})
  351. },
  352. filterOption(input, option) {
  353. return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  354. },
  355. getAllUserList(value) {
  356. this.options = []
  357. getAction('/sys/user/getAllUserList', { pageSize: 50, pageNo: 1, userName: value }).then((res) => {
  358. if (res.success) {
  359. this.options = res.result.list
  360. }
  361. })
  362. },
  363. search(value) {
  364. this.options = []
  365. if (value != '') {
  366. // this.options = this.list.filter(item => {
  367. // var data = item.realName + ' ' + item.roleName
  368. // return data.toLowerCase().indexOf(value.toLowerCase()) > -1
  369. // })
  370. // this.options = [...this.options]
  371. this.getAllUserList(value)
  372. } else {
  373. this.getAllUserList()
  374. }
  375. },
  376. },
  377. mounted() {
  378. this.getAllUserList()
  379. this.getList()
  380. // getAction('/sys/user/getAllUserList', { pageSize: 50, pageNo: 1, userName: '' }).then((res) => {
  381. // if (res.success) {
  382. // this.options = res.result.list
  383. // }
  384. // })
  385. },
  386. }
  387. </script>
  388. <style scoped>
  389. @import '~@assets/less/common.less';
  390. </style>