viewDialog.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <template>
  2. <ele-modal
  3. custom-class="ele-dialog-form long-dialog-form"
  4. :centered="true"
  5. :visible.sync="addOrEditDialogFlag"
  6. :title="'跟进记录'"
  7. :append-to-body="false"
  8. :close-on-click-modal="false"
  9. width="70%"
  10. :before-close="cancel"
  11. :maxable="true"
  12. :resizable="true"
  13. >
  14. <AddFollowDialog22
  15. ref="addFollowDialogRef"
  16. @done="reload"
  17. ></AddFollowDialog22>
  18. <ele-pro-table
  19. ref="table"
  20. :columns="columns"
  21. :datasource="datasource"
  22. height="calc(100vh - 350px)"
  23. class="dict-table"
  24. :initLoad="false"
  25. :selection.sync="selection"
  26. row-key="id"
  27. >
  28. <!-- <template v-slot:content="{ row }">
  29. <el-link type="primary" :underline="false" @click="openDetail(row)">
  30. {{ row.content }}</el-link
  31. >
  32. </template> -->
  33. <template v-slot:files="{ row }">
  34. <fileMain v-model="row.files" type="view"></fileMain>
  35. </template>
  36. <template v-slot:imgs="{ row }">
  37. <el-button v-if="row.imgs && row.imgs.length > 0" type="primary" @click="viewImgs(row)">查看</el-button>
  38. </template>
  39. <template v-slot:toolbar v-if="showAction">
  40. <el-button
  41. size="small"
  42. type="danger"
  43. el-icon-delete
  44. class="ele-btn-icon"
  45. @click="allDelBtn"
  46. :disabled="selection?.length === 0"
  47. >
  48. 批量删除
  49. </el-button>
  50. </template>
  51. <template v-slot:action="{ row }">
  52. <el-link
  53. type="primary"
  54. :underline="false"
  55. icon="el-icon-edit"
  56. @click="openEdit('edit', row)"
  57. >
  58. 修改
  59. </el-link>
  60. <el-popconfirm
  61. class="ele-action"
  62. title="确定要删除此信息吗?"
  63. @confirm="remove(row)"
  64. >
  65. <template v-slot:reference>
  66. <el-link type="danger" :underline="false" icon="el-icon-delete">
  67. 删除
  68. </el-link>
  69. </template>
  70. </el-popconfirm>
  71. </template>
  72. </ele-pro-table>
  73. <div slot="footer">
  74. <el-button @click="cancel">返回</el-button>
  75. </div>
  76. <ele-modal
  77. custom-class="ele-dialog-form long-dialog-form"
  78. :centered="true"
  79. :visible.sync="imgVisible"
  80. :title="'照片'"
  81. :append-to-body="true"
  82. :close-on-click-modal="true"
  83. width="70%"
  84. :before-close="viewImgs"
  85. :maxable="true"
  86. :resizable="true"
  87. >
  88. <div class="ele-border-lighter sys-organization-list">
  89. <img style="width: 160px; margin-right: 10px; margin-bottom: 10px;" v-for="(item, index) in rowImgs" :key="index" :src="item" alt="" srcset="">
  90. </div>
  91. </ele-modal>
  92. <pop-el-modal
  93. :popVisible.sync="delVisible"
  94. content="是否确定删除?"
  95. @done="commitBtn"
  96. />
  97. </ele-modal>
  98. </template>
  99. <script>
  100. import dictMixins from '@/mixins/dictMixins';
  101. // import fileMain from '@/components/addDoc/index.vue';
  102. import popElModal from '@/components/pop-el-modal';
  103. import {
  104. getTableList,
  105. deleteInformation
  106. } from '@/api/saleManage/businessFollow';
  107. import AddFollowDialog22 from './addFollowDialog22.vue';
  108. export default {
  109. mixins: [dictMixins],
  110. components: { AddFollowDialog22, popElModal },
  111. computed: {
  112. columns() {
  113. let section = {
  114. width: 45,
  115. type: 'selection',
  116. columnKey: 'selection',
  117. align: 'center',
  118. reserveSelection: true
  119. };
  120. let arr = [
  121. {
  122. columnKey: 'index',
  123. label: '序号',
  124. type: 'index',
  125. width: 55,
  126. align: 'center',
  127. showOverflowTooltip: true,
  128. fixed: 'left'
  129. },
  130. {
  131. prop: 'contactName',
  132. align: 'center',
  133. label: '客户名称',
  134. showOverflowTooltip: true,
  135. minWidth: 200
  136. },
  137. {
  138. prop: 'opportunityName',
  139. label: '商机名称',
  140. align: 'center',
  141. showOverflowTooltip: true,
  142. minWidth: 200
  143. },
  144. {
  145. prop: 'content',
  146. align: 'center',
  147. label: '跟进内容',
  148. slot: 'content',
  149. showOverflowTooltip: true,
  150. minWidth: 200
  151. },
  152. {
  153. align: 'center',
  154. prop: 'stageName',
  155. label: '跟进阶段',
  156. slot: 'stageName',
  157. showOverflowTooltip: true,
  158. minWidth: 100
  159. },
  160. {
  161. prop: 'agreement',
  162. align: 'center',
  163. label: '达成共识',
  164. showOverflowTooltip: true,
  165. minWidth: 110
  166. },
  167. {
  168. align: 'center',
  169. prop: 'linkName',
  170. label: '客户联系人名称',
  171. showOverflowTooltip: true,
  172. minWidth: 110
  173. },
  174. {
  175. align: 'center',
  176. prop: 'nextPlan',
  177. label: '下一步计划',
  178. showOverflowTooltip: true,
  179. minWidth: 110
  180. },
  181. {
  182. prop: 'followupTime',
  183. label: '跟进时间',
  184. align: 'center',
  185. showOverflowTooltip: true,
  186. minWidth: 110,
  187. formatter: (_row, _column, cellValue) => {
  188. return this.$util.toDateString(cellValue);
  189. }
  190. },
  191. {
  192. prop: 'createTime',
  193. label: '创建时间',
  194. align: 'center',
  195. showOverflowTooltip: true,
  196. minWidth: 110,
  197. formatter: (_row, _column, cellValue) => {
  198. return this.$util.toDateString(cellValue);
  199. }
  200. },
  201. {
  202. prop: 'files',
  203. label: '附件',
  204. align: 'center',
  205. slot: 'files',
  206. showOverflowTooltip: true,
  207. minWidth: 110
  208. },
  209. {
  210. prop: 'imgs',
  211. label: '照片',
  212. align: 'center',
  213. slot: 'imgs',
  214. showOverflowTooltip: true,
  215. minWidth: 110
  216. }
  217. ];
  218. let action = {
  219. columnKey: 'action',
  220. label: '操作',
  221. width: 180,
  222. align: 'center',
  223. resizable: false,
  224. slot: 'action',
  225. showOverflowTooltip: true,
  226. fixed: 'right'
  227. };
  228. if (this.showAction) {
  229. arr.push(action);
  230. arr.unshift(section);
  231. }
  232. return arr;
  233. }
  234. },
  235. data() {
  236. return {
  237. addOrEditDialogFlag: false,
  238. showAction: false,
  239. current: {},
  240. delVisible: false,
  241. selection: [],
  242. imgVisible: false,
  243. rowImgs: []
  244. };
  245. },
  246. mounted() {},
  247. created() {},
  248. methods: {
  249. open(params, type) {
  250. console.log(params);
  251. this.current = params;
  252. this.showAction = type === 'view' ? false : true;
  253. console.log(params);
  254. this.addOrEditDialogFlag = true;
  255. this.$nextTick(() => {
  256. this.reload(params);
  257. });
  258. },
  259. viewImgs(row) {
  260. this.rowImgs = row.imgs;
  261. this.imgVisible = !this.imgVisible
  262. },
  263. /* 表格数据源 */
  264. datasource({ page, limit, where, order }) {
  265. return getTableList({
  266. pageNum: page,
  267. size: limit,
  268. ...where
  269. });
  270. },
  271. /* 刷新表格 */
  272. reload(where) {
  273. this.$refs.table.reload({ pageNum: 1, where: where });
  274. this.$parent.reload();
  275. },
  276. //关闭弹窗
  277. cancel() {
  278. this.addOrEditDialogFlag = false;
  279. },
  280. allDelBtn() {
  281. if (this.selection?.length === 0) return;
  282. this.delVisible = true;
  283. },
  284. openEdit(type, row) {
  285. this.$refs.addFollowDialogRef.open(type, row, this.current);
  286. this.$refs.addFollowDialogRef.$refs.form &&
  287. this.$refs.addFollowDialogRef.$refs.form.clearValidate();
  288. },
  289. remove(row) {
  290. console.log(row);
  291. deleteInformation([row.id]).then((res) => {
  292. this.$message.success('删除成功!');
  293. this.reload();
  294. });
  295. },
  296. commitBtn() {
  297. console.log(this.selection);
  298. const dataId = this.selection.map((v) => v.id);
  299. deleteInformation(dataId).then((res) => {
  300. this.selection = [];
  301. this.$message.success('删除成功!');
  302. this.reload();
  303. });
  304. }
  305. }
  306. };
  307. </script>
  308. <style scoped lang="scss"></style>