TaskImport.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <template>
  2. <div>
  3. <a-card :bordered="false">
  4. <h1>
  5. <span style="font-size: 14px;">资料管理 / 资料上传</span>
  6. </h1>
  7. <div>
  8. <a-button type="primary" @click="showList">返回</a-button>
  9. </div>
  10. </a-card>
  11. <div style="background-color: #ececec; padding: 20px">
  12. <a-row :gutter="16">
  13. <a-col :span="6">
  14. <a-spin :spinning="spinning">
  15. <a-card title="资料类型选择" :bordered="false">
  16. <div class="table-operator">
  17. <a-upload
  18. name="file"
  19. :multiple="false"
  20. :action="importMinioUploadAction"
  21. :headers="tokenHeader"
  22. :showUploadList="false"
  23. :beforeUpload="importBeforeUpload"
  24. @change="importHandleChange">
  25. <a-button>
  26. <a-icon type="upload"/>
  27. 客户资料上传
  28. </a-button>
  29. </a-upload>
  30. </div>
  31. <a-radio-group v-model:value="value1" button-style="solid" style="width: 250px" @change="fileTypeClick">
  32. <a-radio-button style="display: flex" value="businessContract">业务合同</a-radio-button>
  33. <a-radio-button style="display: flex" value="smsNumberCertificate">号码证书</a-radio-button>
  34. <a-radio-button style="display: flex" value="recordNotice">备案通知</a-radio-button>
  35. <a-radio-button style="display: flex" value="groupPriceApproval">集团政企价格审批单</a-radio-button>
  36. <a-radio-button style="display: flex" value="businessLicence">营业执照</a-radio-button>
  37. <a-radio-button style="display: flex" value="customerIntroductionLetter">集团政企价格审批单</a-radio-button>
  38. <a-radio-button style="display: flex" value="handlerIdNumberCopy">经办人身份复印件</a-radio-button>
  39. <a-radio-button style="display: flex" value="crmScreenshot">CRM 行短业务截图</a-radio-button>
  40. <a-radio-button style="display: flex" value="valueAddedLicence">增值业务许可证</a-radio-button>
  41. </a-radio-group>
  42. </a-card>
  43. </a-spin>
  44. </a-col>
  45. <a-col :span="18">
  46. <a-card title="资料详情" :bordered="false">
  47. <a-list item-layout="vertical" :data-source="delList">
  48. <a-list-item slot="renderItem" slot-scope="item, index">
  49. <!-- <pdf
  50. ref="pdf"
  51. :src="item.url">
  52. </pdf>-->
  53. <a-list-item-meta
  54. :description=item.information
  55. >
  56. <a slot="title" :href=item.href>{{ item.title }}</a>
  57. <a-avatar
  58. slot="avatar"
  59. :src=item.url
  60. icon="file"
  61. />
  62. </a-list-item-meta>
  63. <iframe
  64. frameborder="1"
  65. :src=item.href
  66. ref="ifr"
  67. width="100%"
  68. height="560px"
  69. scrolling="auto">
  70. </iframe>
  71. </a-list-item>
  72. </a-list>
  73. </a-card>
  74. </a-col>
  75. </a-row>
  76. </div>
  77. <a-card :bordered="true" style="margin-top: 12px;">
  78. <!-- 操作按钮区域 start -->
  79. <!-- <div class="table-operator">
  80. <a-upload name="file"
  81. :showUploadList="false"
  82. :multiple="false"
  83. :headers="tokenHeader"
  84. :action="url.importExcel"
  85. @change="uploadChange">
  86. <a-button type="primary" icon="upload">客户资料导入</a-button>
  87. </a-upload>
  88. <a-button type="primary" icon="import"
  89. @click="importInfo">确定导入</a-button>
  90. </div>-->
  91. <!-- 操作按钮区域 end -->
  92. <!-- table区域 begin -->
  93. <!-- <div>
  94. <a-table
  95. ref="table"
  96. size="middle"
  97. :scroll="{x:true}"
  98. bordered
  99. :columns="columns"
  100. :dataSource="dataSource"
  101. :pagination="false"
  102. :loading="loading"
  103. class="j-table-force-nowrap"
  104. @change="handleTableChange">
  105. </a-table>
  106. </div>-->
  107. <!-- table区域 end -->
  108. </a-card>
  109. </div>
  110. </template>
  111. <script>
  112. import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  113. import {httpAction} from '@api/manage'
  114. import pdf from 'vue-pdf';
  115. let Base64 = require('js-base64').Base64
  116. export default {
  117. name: 'TaskImport',
  118. mixins: [JeecgListMixin],
  119. props: {
  120. infoId: {
  121. //type: string,
  122. require: true
  123. }
  124. },
  125. setup() {
  126. },
  127. components:{
  128. pdf
  129. },
  130. data() {
  131. return {
  132. spinning: false,
  133. value1: "businessContract",
  134. expandedKeys: ['0-0', '0-1'],
  135. selectedKeys: ['0-0'],
  136. description: '导入页面',
  137. autoSearch: false,
  138. dataSource: [],
  139. errorCount: 0,
  140. url: {
  141. importExcel: window._CONFIG['domainURL'] + "/smsCheck/task/importCustomerExcel",
  142. importData: "/smsCheck/task/importCustomerData",
  143. minioUpload: "/smsCheck/customerData/uploadMinio",
  144. editUrl: "/smsCheck/customerData/edit/info/id",
  145. list: "/smsCheck/customerData/list"
  146. },
  147. delList: [],
  148. }
  149. },
  150. created() {
  151. this.customerDataList();
  152. },
  153. methods: {
  154. customerDataList() {
  155. let model = {
  156. "infoId": this.infoId
  157. }
  158. httpAction(this.url.list, model, "post")
  159. .then((res) => {
  160. if (res.success) {
  161. let records = res.result.records;
  162. if (records.length > 0) {
  163. this.delList = [];
  164. let record = records[0];
  165. let recordElement = record[this.value1];
  166. if (recordElement != null || recordElement != undefined) {
  167. let splitList = recordElement.split(",");
  168. for (var i in splitList) {
  169. let splitListElement = splitList[i];
  170. let split = splitListElement.split("/");
  171. let splitElement = split[split.length - 1];
  172. let del = {
  173. title: splitElement,
  174. href: window._CONFIG['onlinePreviewDomainURL'] + '?url=' + encodeURIComponent(Base64.encode((splitListElement))),
  175. information: "上传用户:" + record.createBy,
  176. url: splitListElement
  177. }
  178. this.delList.push(del)
  179. }
  180. } else {
  181. this.delList = [];
  182. }
  183. } else {
  184. this.delList = [];
  185. }
  186. } else {
  187. }
  188. }).finally(() => {
  189. })
  190. },
  191. importBeforeUpload(file) {
  192. var fileType = file.type;
  193. if (fileType === 'image') {
  194. if (fileType.indexOf('image') < 0) {
  195. this.$message.warning('请上传图片');
  196. return false;
  197. }
  198. } else if (fileType === 'file') {
  199. if (fileType.indexOf('image') >= 0) {
  200. this.$message.warning('请上传文件');
  201. return false;
  202. }
  203. }
  204. return true
  205. },
  206. importHandleChange(info) {
  207. this.spinning = true;
  208. info.file
  209. if (info.file.status === 'done') {
  210. if (info.file.response.success) {
  211. //this.loadData()
  212. this.spinning = false;
  213. this.$message.success(`${info.file.name} 上传成功!`);
  214. let fileUrl = info.file.response.message;
  215. let value1 = this.value1;
  216. let model = {
  217. "infoId": this.infoId,
  218. //value1:fileUrl
  219. }
  220. model[value1] = fileUrl
  221. httpAction(this.url.editUrl, model, "post")
  222. .then((res) => {
  223. if (res.success) {
  224. this.customerDataList();
  225. } else {
  226. }
  227. }).finally(() => {
  228. })
  229. } else {
  230. this.spinning = false;
  231. this.$message.error(`${info.file.response.message}`);
  232. }
  233. } else if (info.file.status === 'error') {
  234. this.spinning = false;
  235. this.$message.error(`${info.file.response.message}`);
  236. }
  237. },
  238. fileTypeClick(a, event) {
  239. //console.log(a)
  240. //console.log(event)
  241. this.customerDataList();
  242. },
  243. radioStyle() {
  244. return {
  245. display: 'flex',
  246. height: '30px',
  247. lineHeight: '30px'
  248. }
  249. },
  250. renderContent(h, {node, data, store}) {
  251. return (
  252. <span class="custom-tree-node">
  253. <span>{node.label}</span>
  254. <span>
  255. <el-button size="mini" type="text" on-click={() => this.append(data)}>Append</el-button>
  256. <el-button size="mini" type="text" on-click={() => this.remove(node, data)}>Delete</el-button>
  257. </span>
  258. </span>);
  259. }
  260. ,
  261. // 显示列表页面
  262. showList() {
  263. this.$emit('goList', true);
  264. },
  265. /**
  266. * 上传事件回调
  267. *
  268. * @param result 回调值
  269. */
  270. importUploadChange(result) {
  271. let file = result.file;
  272. let event = result.event;
  273. if (event === undefined && file.status === 'uploading') {
  274. this.$message.info('开始上传');
  275. }
  276. if (event && file.status === 'uploading') {
  277. this.$message.info('上传中,请稍等……');
  278. }
  279. if (file.response) {
  280. let success = file.response.success;
  281. let message = file.response.message;
  282. if (!success) {
  283. this.$message.error(message);
  284. }
  285. if (file.status === 'done') {
  286. this.dataSource = file.response.result.data;
  287. this.errorCount = file.response.result.errorCount;
  288. if (this.errorCount > 0) {
  289. this.$message.error('导入含有错误项,请检查内容')
  290. } else {
  291. this.$message.info('上传完成');
  292. }
  293. }
  294. }
  295. },
  296. },
  297. computed: {
  298. importMinioUploadAction() {
  299. return window._CONFIG['domianURL'] + this.url.minioUpload;
  300. },
  301. }
  302. }
  303. </script>
  304. <style scoped>
  305. </style>