index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <div class="page">
  3. <template-page v-if="!formDialog" ref="pageRef" :get-list="getList" :table-attributes="tableAttributes"
  4. :table-events="tableEvents" :operationColumnWidth="80" :options-evens-group="optionsEvensGroup"
  5. :moreParameters="moreParameters" :column-parsing="columnParsing" :operation="operation()">
  6. <div slot="moreSearch">
  7. <el-radio-group v-model="status" size="mini" @change="changeType">
  8. <el-radio-button label="ING">继续跟进</el-radio-button>
  9. <el-radio-button label="END">无需跟进</el-radio-button>
  10. <el-radio-button label="">全部</el-radio-button>
  11. </el-radio-group>
  12. <br><br>
  13. </div>
  14. </template-page>
  15. <div class="detail" v-if="formDialog">
  16. <detail :id="id" :activeId="activeId" @back="backList" :formType="formDialogType" :title="'活动单' + formDialogTitles[formDialogType]"></detail>
  17. </div>
  18. <!-- 批量跟进 -->
  19. <el-dialog title="批量跟进" :visible.sync="isShow" width="50%" :close-on-click-modal="false" :modal-append-to-body="false" @close="formData = {status: 'END',remark: ''}">
  20. <el-form ref="formData" :model="formData" label-width="110px" size="small" label-position="left">
  21. <el-row :gutter="20" justify="start">
  22. <el-col :span="24">
  23. <el-form-item label="最新跟进结果" prop="status" :required="true">
  24. <el-radio-group v-model="formData.status">
  25. <el-radio label="ING">继续跟进</el-radio>
  26. <el-radio label="END">无需跟进</el-radio>
  27. </el-radio-group>
  28. </el-form-item>
  29. </el-col>
  30. <el-col :span="24">
  31. <el-form-item label="备注" prop="remark" :rules="[{ required: true, message: `请输入备注内容`, trigger: 'blur' }]">
  32. <el-input type="textarea" :rows="3" v-model="formData.remark" placeholder="请输入"></el-input>
  33. </el-form-item>
  34. </el-col>
  35. </el-row>
  36. </el-form>
  37. <div class="footer">
  38. <el-button size="mini" @click="isShow = false">取消</el-button>
  39. <el-button size="mini" @click="formConfirm()" type="primary">确定</el-button>
  40. </div>
  41. </el-dialog>
  42. <!-- 导出 -->
  43. <el-dialog title="选择导出日期" :visible.sync="isShowDate" width="50%" :close-on-click-modal="false" :modal-append-to-body="false" @close="formData1.date = []">
  44. <el-form ref="formData1" :model="formData1" label-width="110px" size="small" label-position="left">
  45. <el-row :gutter="20" justify="start">
  46. <el-col :span="24">
  47. <el-form-item label="提交日期范围" prop="date" :rules="[{ required: true, message: `请选择日期`, trigger: 'change' }]">
  48. <el-date-picker
  49. v-model="formData1.date"
  50. type="daterange"
  51. value-format="yyyy-MM-dd"
  52. range-separator="至"
  53. start-placeholder="开始日期"
  54. end-placeholder="结束日期">
  55. </el-date-picker>
  56. </el-form-item>
  57. </el-col>
  58. </el-row>
  59. </el-form>
  60. <div class="footer">
  61. <el-button size="mini" @click="isShowDate = false">取消</el-button>
  62. <el-button size="mini" @click="formConfirm1()" type="primary">确定</el-button>
  63. </div>
  64. </el-dialog>
  65. </div>
  66. </template>
  67. <script>
  68. import TemplatePage from '@/components/template/template-page-1.vue'
  69. import detail from './detail.vue'
  70. import import_mixin from '@/components/template/import_mixin.js'
  71. import ImageUpload from '@/components/file-upload'
  72. import { downloadFiles } from '@/utils/util'
  73. import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
  74. import { listPageV2, pageExport, getDetail, add, follow } from "@/api/activityOrder";
  75. import operation_mixin from '@/components/template/operation_mixin.js'
  76. export default {
  77. components: { TemplatePage, ImageUpload, detail },
  78. mixins: [import_mixin, operation_mixin],
  79. data() {
  80. return {
  81. // 表格属性
  82. tableAttributes: {
  83. // 启用勾选列
  84. selectColumn: true,
  85. selectable: this.selectable
  86. },
  87. // 表格事件
  88. tableEvents: {
  89. 'selection-change': this.selectionChange
  90. },
  91. // 勾选选中行
  92. recordSelected: [],
  93. /** 表单变量 */
  94. formDialogType: 0,
  95. formDialogTitles: ["新增", "跟进", "详情"],
  96. formDialog: false,
  97. status: 'ING',
  98. id: '',
  99. activeId: '',
  100. promotion_questionnaire_id: '',
  101. isShow: false,
  102. isShowDate: false,
  103. formData: {
  104. status: 'END',
  105. remark: ''
  106. },
  107. formData1: {
  108. date: []
  109. }
  110. }
  111. },
  112. computed: {
  113. // 事件组合
  114. optionsEvensGroup() {
  115. return [
  116. [
  117. [
  118. this.optionsEvensAuth("add", {
  119. click: this.addData
  120. }),
  121. ]
  122. ],
  123. [
  124. [
  125. this.optionsEvensAuth("followUpMore", {
  126. click: this.followMore
  127. }),
  128. ]
  129. ],
  130. [
  131. [
  132. this.optionsEvensAuth("exp", {
  133. click: this.openDate
  134. }),
  135. ]
  136. ],
  137. ]
  138. },
  139. // 更多参数
  140. moreParameters() {
  141. return []
  142. },
  143. formItems() { },
  144. },
  145. created(){
  146. if(this.pageType == 'detail'){
  147. this.activeId = this.pageCode
  148. this.formDialog = true
  149. }
  150. },
  151. methods: {
  152. // 切换状态
  153. changeType(val) {
  154. this.$refs.pageRef.refreshList()
  155. },
  156. backList() {
  157. this.id = ''
  158. this.formDialog = false;
  159. this.$refs?.pageRef?.refreshList()
  160. },
  161. // 列表请求函数
  162. getList(p, cb) {
  163. try {
  164. var pam = JSON.parse(JSON.stringify(p))
  165. pam.params.push({ "param": "a.status", "compare": "=", "value": this.status },{ "param": "a.promotion_questionnaire_id", "compare": "=", "value": this.pageCode?this.pageCode:'' })
  166. cb && cb(pam)
  167. return listPageV2(pam)
  168. } catch (error) {
  169. console.log(error)
  170. }
  171. },
  172. // 列表导出函数
  173. // exportList: pageExport,
  174. // 表格列解析渲染数据更改
  175. columnParsing(item, defaultData) {
  176. if (item.jname === 'startTime') {
  177. defaultData.render = (h, { row, index, column }) => {
  178. return (
  179. <div style="padding:0 6px;cursor: pointer;">
  180. {row.startTime.substring(0,10)}
  181. </div>
  182. )
  183. }
  184. }
  185. if (item.jname === 'endTime') {
  186. defaultData.render = (h, { row, index, column }) => {
  187. return (
  188. <div style="padding:0 6px;cursor: pointer;">
  189. {row.endTime.substring(0,10)}
  190. </div>
  191. )
  192. }
  193. }
  194. return defaultData
  195. },
  196. selectable(row, index) {
  197. return ["ING"].includes(Object.entries(row.selectMapData.status).find(([key, val]) => val == row.status)?.[0])
  198. },
  199. // 监听勾选变化
  200. selectionChange(data) {
  201. this.recordSelected = data
  202. },
  203. openDate(){
  204. this.isShowDate = true
  205. },
  206. operation() {
  207. return this.operationBtn({
  208. followUp: {
  209. conditions: ({ row, index, column }) => {
  210. return row.status == 'ING'
  211. },
  212. click: ({ row, index, column }) => {
  213. this.id = row.promotionActivityId
  214. this.formDialogType = 1
  215. this.openForm()
  216. }
  217. },
  218. detail: {
  219. click: ({ row, index, column }) => {
  220. this.id = row.promotionActivityId
  221. this.formDialogType = 2
  222. this.openForm()
  223. }
  224. }
  225. })
  226. },
  227. addData() {
  228. this.formDialogType = 0
  229. this.openForm()
  230. },
  231. openForm() {
  232. this.formDialog = true;
  233. },
  234. followMore() {
  235. if (this.recordSelected.length == 0) {
  236. return this.$message.warning('请至少勾选一条数据!');
  237. }
  238. this.isShow = true
  239. },
  240. formConfirm() {
  241. let ids = this.recordSelected.map(item => { return item.promotionActivityId })
  242. this.$refs.formData.validate((valid, invalidFields, errLabels) => {
  243. if (valid) {
  244. this.$confirm('请确认是否批量跟进选中的数据, 是否继续?', '提示', {
  245. confirmButtonText: '确定',
  246. cancelButtonText: '取消',
  247. type: 'warning'
  248. }).then(() => {
  249. follow({
  250. ids,
  251. status: this.formData.status,
  252. remark: this.formData.remark
  253. }).then(res => {
  254. this.isShow = false
  255. this.$refs?.formData?.resetFields()
  256. this.$message({ type: 'success', message: '批量跟进成功!' })
  257. this.$refs.pageRef.refreshList()
  258. })
  259. });
  260. }
  261. })
  262. },
  263. //确认导出
  264. formConfirm1() {
  265. this.$refs.formData1.validate((valid, invalidFields, errLabels) => {
  266. if (valid) {
  267. downloadFiles('promotion/activity/export',{statDate: this.formData1.date[0] + ' 00:00:00',endDate: this.formData1.date[1] + ' 23:59:59'});
  268. this.isShowDate = false
  269. }
  270. })
  271. },
  272. }
  273. }
  274. </script>
  275. <style lang="scss" scoped>
  276. .page {
  277. height: 100%;
  278. }
  279. .tab {
  280. padding: 20px 20px 0 20px;
  281. }
  282. .importResultList {
  283. .item {
  284. font-size: 16px;
  285. margin-bottom: 10px;
  286. }
  287. }
  288. .footer{
  289. display: flex;
  290. justify-content: flex-end;
  291. }
  292. </style>