ProjectList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  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,record">{{ record.maxBid == 0? '-': record.maxBid / 1000 }}</span>
  120. <span slot="maxDeepCpaBid" slot-scope="text">{{ text / 1000 }}</span>
  121. <span slot="ocpxActionType" slot-scope="text,record">
  122. <div v-if="!!record.ocpxActionTypeArray&&record.ocpxActionTypeArray.length>0">
  123. <span v-for="(item, index) in record.ocpxActionTypeArray" :key="index"
  124. >{{item.ocpxName}}({{(item.maxValue / 1000).toFixed(2)}})<br></span
  125. >
  126. </div>
  127. <div v-else>-</div>
  128. <!-- {{ text | ocpxActionType }} -->
  129. </span>
  130. <span slot="deepConversionType" slot-scope="text,record">
  131. <div v-if="!!record.deepConversionTypeArray&&record.deepConversionTypeArray.length != 0">
  132. <span v-for="(item, index) in record.deepConversionTypeArray" :key="index"
  133. >{{item.deepName}}({{(item.deepValue / 1000).toFixed(2)}})<br></span
  134. >
  135. </div>
  136. <div v-else>-</div>
  137. <!-- {{ text | ocpxActionType }} -->
  138. </span>
  139. <span slot="bidType" slot-scope="text">
  140. <div v-if="text && JSON.parse(text).length > 0">
  141. <span v-for="(item, index) of JSON.parse(text)" :key="index"
  142. >{{ item | bidType }}{{ index == JSON.parse(text).length - 1 ? '' : '、' }}</span
  143. >
  144. </div>
  145. <div v-else>-</div>
  146. </span>
  147. <span slot="mediaId" slot-scope="text">
  148. {{ text == '1' || text == '3' ? '头条' : '快手' }}
  149. </span>
  150. <span slot="action" slot-scope="text, record">
  151. <a @click="handleEdit(record)">编辑</a>
  152. <a-divider type="vertical" />
  153. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  154. <a>删除</a>
  155. </a-popconfirm>
  156. <!-- /ctop/project/edit -->
  157. </span>
  158. <span slot="materialShare" slot-scope="text, record">
  159. <a-switch :checked='text==0' @change="onChange(text,record)" :loading="spinning"/>
  160. </span>
  161. </a-table>
  162. </div>
  163. <!-- table区域-end -->
  164. <!-- 表单区域 -->
  165. <project-modal ref="modalForm" @ok="modalFormOk"></project-modal>
  166. </a-card>
  167. </template>
  168. <script>
  169. import ProjectModal from './modules/projectListModal'
  170. import JTreeSelect from '@/components/jeecg/JTreeSelect'
  171. import { httpAction, getAction } from '@/api/manage'
  172. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  173. import { mapActions, mapGetters } from 'vuex'
  174. export default {
  175. name: 'ProjectList',
  176. mixins: [JeecgListMixin],
  177. components: {
  178. ProjectModal,
  179. JTreeSelect,
  180. },
  181. data() {
  182. return {
  183. description: '项目管理页面',
  184. // 表头
  185. columns: [
  186. {
  187. title: '项目名称',
  188. align: 'center',
  189. dataIndex: 'projectName',
  190. },
  191. {
  192. title: '广告主名称',
  193. align: 'center',
  194. dataIndex: 'advertiserId_dictText',
  195. },
  196. {
  197. title: '最高出价',
  198. align: 'center',
  199. dataIndex: 'maxBid',
  200. scopedSlots: {
  201. customRender: 'maxBid',
  202. },
  203. },
  204. {
  205. title: '最高转化出价',
  206. align: 'center',
  207. dataIndex: 'maxDeepCpaBid',
  208. scopedSlots: {
  209. customRender: 'maxDeepCpaBid',
  210. },
  211. },
  212. {
  213. title: '优化目标',
  214. align: 'center',
  215. dataIndex: 'bidType',
  216. scopedSlots: {
  217. customRender: 'bidType',
  218. },
  219. },
  220. {
  221. title: '转化目标(出价/元)',
  222. align: 'center',
  223. dataIndex: 'ocpxActionType',
  224. scopedSlots: {
  225. customRender: 'ocpxActionType',
  226. },
  227. },
  228. {
  229. title: '深度转化目标(出价)',
  230. align: 'center',
  231. dataIndex: 'deepConversionType',
  232. scopedSlots: {
  233. customRender: 'deepConversionType',
  234. },
  235. },
  236. {
  237. title: '供应商',
  238. align: 'center',
  239. dataIndex: 'supplierCode_dictText',
  240. },
  241. {
  242. title: '销售',
  243. align: 'center',
  244. dataIndex: 'saleId_dictText',
  245. },
  246. {
  247. title: '运营负责人',
  248. align: 'center',
  249. dataIndex: 'responsibleId_dictText',
  250. },
  251. {
  252. title: '设计负责人',
  253. align: 'center',
  254. dataIndex: 'designResponsibleId_dictText',
  255. },
  256. {
  257. title: '媒体',
  258. align: 'center',
  259. dataIndex: 'mediaId',
  260. scopedSlots: {
  261. customRender: 'mediaId',
  262. },
  263. },
  264. {
  265. title: '是否共享素材',
  266. align: 'center',
  267. dataIndex: 'materialShare',
  268. scopedSlots: {
  269. customRender: 'materialShare',
  270. },
  271. },
  272. {
  273. title: '操作',
  274. dataIndex: 'action',
  275. align: 'center',
  276. scopedSlots: {
  277. customRender: 'action',
  278. },
  279. },
  280. ],
  281. url: {
  282. list: '/ctop/project/list',
  283. delete: '/ctop/project/delete',
  284. deleteBatch: '/ctop/project/deleteBatch',
  285. exportXlsUrl: 'ctop/project/exportXls',
  286. importExcelUrl: 'ctop/project/importExcel',
  287. },
  288. list: [],
  289. options: [],
  290. spinning: false
  291. }
  292. },
  293. filters: {
  294. bidType(sta) {
  295. var data = {
  296. null: '-',
  297. 1: 'CPM',
  298. 2: 'CPC',
  299. 6: 'OCPC',
  300. 10: 'OCPM',
  301. 12: "最大转化"
  302. }
  303. return data[sta]
  304. },
  305. },
  306. computed: {
  307. importExcelUrl: function () {
  308. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
  309. },
  310. },
  311. methods: {
  312. onChange(text,record) {
  313. this.spinning=true;
  314. console.log(text,record)
  315. let materialShare=text==1?0:1;
  316. httpAction(`/ctop/project/edit`,{
  317. id:record.id,
  318. materialShare
  319. },'put').then((res)=>{
  320. if(res.success) {
  321. this.spinning=false;
  322. this.$message.success('修改成功')
  323. this.modalFormOk()
  324. }else {
  325. this.spinning=false;
  326. this.$message.success(res.message)
  327. this.modalFormOk()
  328. }
  329. })
  330. },
  331. ...mapGetters(['nickname', 'avatar', 'userInfo']),
  332. getList() {
  333. var params = {}
  334. // params.userId = this.userInfo().id
  335. params.pageSize = 1000
  336. params.pageNo = 1
  337. params.userId = this.userInfo().id
  338. getAction('/ctop/advertiser/list', params)
  339. .then((res) => {
  340. if (res.success) {
  341. this.list = res.result.records
  342. } else {
  343. this.$message.warning(res.message)
  344. }
  345. })
  346. .finally(() => {})
  347. },
  348. filterOption(input, option) {
  349. return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  350. },
  351. getAllUserList(value) {
  352. this.options = []
  353. getAction('/sys/user/getAllUserList', { pageSize: 50, pageNo: 1, userName: value }).then((res) => {
  354. if (res.success) {
  355. this.options = res.result.list
  356. }
  357. })
  358. },
  359. search(value) {
  360. this.options = []
  361. if (value != '') {
  362. // this.options = this.list.filter(item => {
  363. // var data = item.realName + ' ' + item.roleName
  364. // return data.toLowerCase().indexOf(value.toLowerCase()) > -1
  365. // })
  366. // this.options = [...this.options]
  367. this.getAllUserList(value)
  368. } else {
  369. this.getAllUserList()
  370. }
  371. },
  372. },
  373. mounted() {
  374. this.getAllUserList()
  375. this.getList()
  376. // getAction('/sys/user/getAllUserList', { pageSize: 50, pageNo: 1, userName: '' }).then((res) => {
  377. // if (res.success) {
  378. // this.options = res.result.list
  379. // }
  380. // })
  381. },
  382. }
  383. </script>
  384. <style scoped>
  385. @import '~@assets/less/common.less';
  386. </style>