companyRel.vue 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090
  1. <template>
  2. <el-tabs type="border-card">
  3. <el-tab-pane label="我的链属">
  4. <el-card class="fiche">
  5. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList">收起</right-toolbar>
  6. <span style="margin-bottom: 10px;color:#333333;font:14px Helvetica Neue, Helvetica, PingFang SC, Tahoma, Arial,sans-serif">所选条件:</span>
  7. <div style="float: right;margin-right:1%">
  8. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  9. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery" style="float: ;">重置</el-button>
  10. <column-setting :checkList="checkList" :tableList="tableList" :selfDom="selfDom" :tableId="tableId" style="margin-left:5px"></column-setting>
  11. </div>
  12. <hr style="margin-top: 16px;">
  13. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
  14. <el-form-item label="企业名称" prop="companyName">
  15. <el-input
  16. maxlength="30"
  17. v-model="queryParams.companyName"
  18. placeholder="请输入企业名称"
  19. clearable
  20. size="small"
  21. @keyup.enter.native="handleQuery"
  22. />
  23. </el-form-item>
  24. <el-form-item label="社会统一代码" prop="scySocialCode" >
  25. <el-input
  26. maxlength="30"
  27. v-model="queryParams.scySocialCode"
  28. placeholder="请输入社会统一代码"
  29. clearable
  30. size="small"
  31. @keyup.enter.native="handleQuery"
  32. />
  33. </el-form-item>
  34. <el-form-item label="链属状态" prop="scrStatus">
  35. <el-select v-model="queryParams.scrStatus"
  36. placeholder="链属状态"
  37. clearable
  38. size="small"
  39. style="width: 215px">
  40. <el-option
  41. v-for="dict in scrStatusOptions"
  42. :key="dict.dictValue"
  43. :label="dict.dictLabel"
  44. :value="dict.dictValue"
  45. ></el-option>
  46. </el-select>
  47. </el-form-item>
  48. <el-form-item label="链属关系" prop="scrType">
  49. <el-select v-model="queryParams.scrType"
  50. placeholder="链属关系"
  51. clearable
  52. size="small"
  53. style="width: 215px">
  54. <el-option
  55. v-for="dict in scrTypeOptions"
  56. :key="dict.dictValue"
  57. :label="dict.dictLabel"
  58. :value="dict.dictValue"
  59. ></el-option>
  60. </el-select>
  61. </el-form-item>
  62. </el-form>
  63. </el-card>
  64. <el-row :gutter="10" class="mb8">
  65. <el-col :span="1.5">
  66. <el-button
  67. type="primary"
  68. icon="el-icon-plus"
  69. size="mini"
  70. @click="handleAdd"
  71. v-hasPermi="['service:rel:add']"
  72. >新增</el-button>
  73. </el-col>
  74. <el-col :span="1.5">
  75. <el-button
  76. type="warning"
  77. icon="el-icon-upload2"
  78. size="mini"
  79. @click="handleImport"
  80. v-hasPermi="['service:relImport:importData']"
  81. style="background-color: #23C6C8;
  82. border-color:#23C6C8"
  83. >导入</el-button>
  84. </el-col>
  85. </el-row>
  86. <el-table v-loading="loading" :data="companyRelList" stripe border>
  87. <el-table-column label="序号" type="index" width="50" align="center">
  88. <template slot-scope="scope">
  89. <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
  90. </template>
  91. </el-table-column>
  92. <el-table-column label="社会统一代码" align="center" prop="companyCode" v-if="uncheckList.companyCode" show-overflow-tooltip>
  93. <template slot-scope="scope">
  94. <span v-if="scope.row.launch">{{scope.row.receiveScySocialCode}}</span>
  95. <span v-else>{{scope.row.launchScySocialCode}}</span>
  96. </template>
  97. </el-table-column>
  98. <el-table-column label="企业名称" align="center" prop="companyName" v-if="uncheckList.companyName" show-overflow-tooltip>
  99. <template slot-scope="scope">
  100. <span v-if="scope.row.launch">{{scope.row.receiveScyName}}</span>
  101. <span v-else>{{scope.row.launchScyName}}</span>
  102. </template>
  103. </el-table-column>
  104. <el-table-column label="链属关系" align="center" prop="companyType" v-if="uncheckList.companyType">
  105. <template slot-scope="scope">
  106. <span v-if="scope.row.launch">{{companyTypeFormat(scope.row.launchScrReceiveType)}}</span>
  107. <span v-else>{{companyTypeFormat(scope.row.launchScrLaunchType)}}</span>
  108. </template>
  109. </el-table-column>
  110. <el-table-column label="联系人" align="center" prop="launchScrContarct" v-if="uncheckList.launchScrContarct">
  111. </el-table-column>
  112. <el-table-column label="联系电话" align="center" prop="launchScrContarctPhone" v-if="uncheckList.launchScrContarctPhone">
  113. </el-table-column>
  114. <el-table-column label="邮箱" align="center" prop="launchScrContarctEmail" v-if="uncheckList.launchScrContarctEmail" show-overflow-tooltip>
  115. </el-table-column>
  116. <el-table-column label="状态" align="center" prop="launchScrStatus" v-if="uncheckList.launchScrStatus" :formatter="launchScrStatusFormat">
  117. </el-table-column>
  118. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
  119. <template slot-scope="scope">
  120. <el-button
  121. size="mini"
  122. type="text"
  123. @click="handleCompanyQuery(scope.row)"
  124. v-hasPermi="['service:rel:query']"
  125. >详情</el-button>
  126. <el-button
  127. v-if="scope.row.launch && scope.row.launchScrReceiveType == '01' && scope.row.launchScrStatus =='01'"
  128. v-else="scope.row.launchScrLaunchType == '01' && scope.row.launchScrStatus =='01'"
  129. size="mini"
  130. type="text"
  131. @click="handleDelete(scope.row)"
  132. v-hasPermi="['service:rel:delete']"
  133. >解绑</el-button>
  134. <el-button
  135. v-if="handleRel && scope.row.launchScrStatus =='00' && scope.row.receive"
  136. size="mini"
  137. type="text"
  138. @click="handleSuccess(scope.row)"
  139. v-hasPermi="['service:rel:update']"
  140. >确认链属</el-button>
  141. <el-button
  142. v-if="handleRel && scope.row.launchScrStatus =='00' && scope.row.receive"
  143. size="mini"
  144. type="text"
  145. @click="handleRefuse(scope.row)"
  146. v-hasPermi="['service:rel:update']"
  147. >拒绝</el-button>
  148. </template>
  149. </el-table-column>
  150. </el-table>
  151. <pagination
  152. v-show="total > 0"
  153. :total="total"
  154. :page.sync="queryParams.pageNum"
  155. :limit.sync="queryParams.pageSize"
  156. @pagination="getList"
  157. />
  158. </el-tab-pane>
  159. <el-tab-pane label="链属未认证">
  160. <!-- 未认证列表 -->
  161. <el-card class="fiche">
  162. <right-toolbar :showSearch.sync="showSearch" @queryTable="getSpare">收起</right-toolbar>
  163. <span style="margin-bottom: 10px;color:#333333;font:14px Helvetica Neue, Helvetica, PingFang SC, Tahoma, Arial,sans-serif">所选条件:</span>
  164. <div style="float: right;margin-right:1%">
  165. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleSpareQuery">搜索</el-button>
  166. <el-button icon="el-icon-refresh" size="mini" @click="resetSpareQuery" style="float: ;">重置</el-button>
  167. </div>
  168. <hr style="margin-top: 16px;">
  169. <el-form :model="spareParams" ref="querySpareForm" :inline="true" v-show="showSearch" label-width="100px">
  170. <el-form-item label="企业名称" prop="companyName">
  171. <el-input
  172. maxlength="30"
  173. v-model="spareParams.companyName"
  174. placeholder="请输入企业名称"
  175. clearable
  176. size="small"
  177. @keyup.enter.native="handleSpareQuery"
  178. />
  179. </el-form-item>
  180. <el-form-item label="社会统一代码" prop="scySocialCode" >
  181. <el-input
  182. maxlength="30"
  183. style="width: 230px"
  184. v-model="spareParams.scySocialCode"
  185. placeholder="请输入社会统一代码"
  186. clearable
  187. size="small"
  188. @keyup.enter.native="handleSpareQuery"
  189. />
  190. </el-form-item>
  191. <el-form-item label="链属关系" prop="scrType">
  192. <el-select v-model="spareParams.scrType"
  193. placeholder="请选择链属关系"
  194. clearable
  195. size="small"
  196. style="width: 215px">
  197. <el-option
  198. v-for="dict in scrTypeOptions"
  199. :key="dict.dictValue"
  200. :label="dict.dictLabel"
  201. :value="dict.dictValue"
  202. ></el-option>
  203. </el-select>
  204. </el-form-item>
  205. </el-form>
  206. </el-card>
  207. <el-row :gutter="10" class="mb8">
  208. <el-col :span="1.5">
  209. <el-button
  210. type="primary"
  211. icon="el-icon-plus"
  212. size="mini"
  213. @click="handleAdd"
  214. v-hasPermi="['service:rel:add']"
  215. >新增</el-button>
  216. </el-col>
  217. <el-col :span="1.5">
  218. <el-button
  219. type="warning"
  220. icon="el-icon-upload2"
  221. size="mini"
  222. @click="handleImport"
  223. v-hasPermi="['service:relImport:importData']"
  224. style="background-color: #23C6C8;
  225. border-color:#23C6C8"
  226. >导入</el-button>
  227. </el-col>
  228. </el-row>
  229. <!-- 未认证企业信息列表 -->
  230. <el-table v-loading="loading" :data="spareOwnlist" stripe border>
  231. <el-table-column label="序号" type="index" width="50" align="center">
  232. <template slot-scope="scope">
  233. <span>{{(spareParams.pageNum - 1) * spareParams.pageSize + scope.$index + 1}}</span>
  234. </template>
  235. </el-table-column>
  236. <el-table-column label="企业名称" align="center" width="202" prop="scpName" show-overflow-tooltip/>
  237. <el-table-column label="社会统一代码" align="center" width="151" prop="scpSocialCode" show-overflow-tooltip/>
  238. <el-table-column label="链属关系" align="center" width="91" prop="scpType" :formatter="scpTypeFormat" />
  239. <el-table-column label="联系人" align="center" width="83" prop="scpContarct" />
  240. <el-table-column label="联系电话" align="center" width="109" prop="scpContarctPhone" show-overflow-tooltip />
  241. <el-table-column label="邮箱" align="center" width="187" prop="scpContarctEmail" show-overflow-tooltip/>
  242. <el-table-column label="状态" align="center" width="80" prop="scpStatus" :formatter="scpStatusFormat" />
  243. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
  244. <template slot-scope="scope">
  245. <el-button
  246. v-if="scope.row.scpInvite == '1'"
  247. size="mini"
  248. type="text"
  249. @click="handleInvite(scope.row)"
  250. v-hasPermi="['service:spare:invite']"
  251. >重邀</el-button>
  252. <el-button
  253. size="mini"
  254. type="text"
  255. @click="handleSpareDelete(scope.row)"
  256. v-hasPermi="['service:rel:delete']"
  257. >解绑</el-button>
  258. </template>
  259. </el-table-column>
  260. </el-table>
  261. <pagination
  262. v-show="spareTitol > 0"
  263. :total="spareTitol"
  264. :page.sync="spareParams.pageNum"
  265. :limit.sync="spareParams.pageSize"
  266. @pagination="getSpare"
  267. />
  268. </el-tab-pane>
  269. <!-- 添加链属框 -->
  270. <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
  271. <el-form ref="form" :model="form" :rules="rules" label-width="140px" :inline="true">
  272. <el-form-item label="企业编号" prop="scyId" style="display:none" >
  273. <el-input v-model="form.scyId" disabled />
  274. </el-form-item>
  275. <el-form-item label="链属关系" prop="scrReceiveType">
  276. <el-select v-model="form.scrReceiveType"
  277. placeholder="请选择链属关系"
  278. clearable
  279. size="small"
  280. style="width: 215px">
  281. <el-option
  282. v-for="dict in scrTypeOptions"
  283. :key="dict.dictValue"
  284. :label="dict.dictLabel"
  285. :value="dict.dictValue"
  286. ></el-option>
  287. </el-select>
  288. </el-form-item>
  289. <el-form-item label="企业名称" prop="scyName">
  290. <el-select
  291. v-model="form.scyName"
  292. filterable
  293. allow-create
  294. clearable
  295. @clear="clearRemote"
  296. remote
  297. reserve-keyword
  298. @change="choice"
  299. placeholder="请输入关键词"
  300. :remote-method="remoteMethod"
  301. >
  302. <el-option
  303. v-for="item in companyList"
  304. :key="item.value"
  305. :label="item.label"
  306. :value="item.value">
  307. </el-option>
  308. </el-select>
  309. </el-form-item>
  310. <el-form-item label="企业统一代码" prop="scySocialCode">
  311. <el-input v-model="form.scySocialCode" placeholder="请输入企业统一代码" maxlength="18" show-word-limit />
  312. </el-form-item>
  313. <el-form-item label="联系人" prop="scrContarct">
  314. <el-input v-model="form.scrContarct" placeholder="请输入联系人" maxlength="10" show-word-limit />
  315. </el-form-item>
  316. <el-form-item label="联系人手机号" prop="scrContarctPhone">
  317. <el-input v-model="form.scrContarctPhone" placeholder="请输入联系人手机号" maxlength="11" show-word-limit />
  318. </el-form-item>
  319. <el-form-item label="邮箱" prop="scrContarctEmail">
  320. <el-input v-model="form.scrContarctEmail" placeholder="请输入邮箱" maxlength="60" show-word-limit />
  321. </el-form-item>
  322. </el-form>
  323. <div slot="footer" class="dialog-footer">
  324. <el-button type="primary" @click="submitForm">确 定</el-button>
  325. <el-button @click="cancel">取 消</el-button>
  326. </div>
  327. </el-dialog>
  328. <!-- 企业详情对话框 -->
  329. <el-dialog :title="titleDetail" :visible.sync="openDetail" width="800px" append-to-body >
  330. <el-form ref="formDetail" :model="formDetail" label-width="140px" :inline="true">
  331. <el-form-item label="企业名称" prop="scyName" >
  332. <el-input v-model="formDetail.scyName" placeholder="请输入企业名称" disabled style="width:560px" maxlength="20" show-word-limit/>
  333. </el-form-item>
  334. <el-form-item label="企业统一代码" prop="scySocialCode">
  335. <el-input v-model="formDetail.scySocialCode" placeholder="请输入企业统一代码" disabled maxlength="18" show-word-limit/>
  336. </el-form-item>
  337. <el-form-item label="联系人" prop="scyLegal">
  338. <el-input v-model="formDetail.scyLegal" placeholder="请输入联系人" disabled maxlength="5" show-word-limit/>
  339. </el-form-item>
  340. <el-form-item label="联系人手机号" prop="scyPhone">
  341. <el-input v-model="formDetail.scyPhone" placeholder="请输入联系人手机号" disabled maxlength="11" show-word-limit/>
  342. </el-form-item>
  343. </el-form>
  344. <div slot="footer" class="dialog-footer">
  345. <el-button @click="cancelDetail">取 消</el-button>
  346. </div>
  347. </el-dialog>
  348. <!-- 导入窗口 -->
  349. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  350. <el-upload
  351. ref="upload"
  352. :limit="1"
  353. accept=".xlsx, .xls"
  354. :headers="upload.headers"
  355. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  356. :disabled="upload.isUploading"
  357. :on-progress="handleFileUploadProgress"
  358. :on-success="handleFileSuccess"
  359. :auto-upload="false"
  360. drag
  361. >
  362. <i class="el-icon-upload"></i>
  363. <div class="el-upload__text">
  364. 将文件拖到此处,或
  365. <em>点击上传</em>
  366. </div>
  367. <div class="el-upload__tip" slot="tip">
  368. <el-link type="info" style="font-size:12px" @click="importTemplate" >下载模板</el-link>
  369. </div>
  370. <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
  371. </el-upload>
  372. <div slot="footer" class="dialog-footer">
  373. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  374. <el-button @click="upload.open = false">取 消</el-button>
  375. </div>
  376. </el-dialog>
  377. </el-tabs>
  378. </template>
  379. <script>
  380. import {
  381. listRel, sparelist, listCompany, addRel, updateRel, listAllCompany,
  382. delRel, removeSpare, listCompanyQuery, getUser, againInvite
  383. } from "@/api/service/rel/companyRel";
  384. import { uploadFileNew } from "@/api/common/file";
  385. import { getToken } from "@/utils/auth";
  386. import {columnQuery,columnfilter} from "@/api/common/columnSetting";
  387. import ColumnSetting from '../../../components/Table/columnSetting.vue';
  388. import Cookies from 'js-cookie'
  389. export default {
  390. name: "companyRel",
  391. components: {
  392. ColumnSetting
  393. },
  394. data() {
  395. return {
  396. //操作员企业Id
  397. loginId : '',
  398. userId : "",
  399. scyTypeNow : '',
  400. handleRel:false,
  401. // 遮罩层
  402. loading: true,
  403. // 选中数组
  404. ids: [],
  405. // 非单个禁用
  406. single: true,
  407. rel : true,
  408. spare : false,
  409. // 非多个禁用
  410. multiple: true,
  411. // 显示搜索条件
  412. showSearch: true,
  413. // 总条数
  414. total: 0,
  415. spareTitol: 0,
  416. // 公司数据
  417. companyList: [],
  418. //链属表格数据
  419. companyRelList: [],
  420. //链属未认证列表数据
  421. spareOwnlist : [],
  422. // 状态数据字典
  423. scrStatusOptions: [],
  424. scrTypeOptions : [],
  425. scpStatusOptions : [],
  426. listCom : [],
  427. comlist : [],
  428. // 弹出层标题
  429. title: "",
  430. templateTitle:'',
  431. titleDetail:'',
  432. // 是否显示弹出层
  433. open: false,
  434. templateOpen : false,
  435. openDetail:false,
  436. idShow: true,
  437. // 导入参数
  438. upload: {
  439. // 是否显示弹出层(导入)
  440. open: false,
  441. // 弹出层标题(导入)
  442. title: "",
  443. // 是否禁用上传
  444. isUploading: false,
  445. // 是否更新已经存在的用户数据
  446. updateSupport: 0,
  447. // 设置上传的请求头部
  448. headers: { Authorization: "Bearer " + getToken() },
  449. // 上传的地址
  450. url: process.env.VUE_APP_BASE_API + "/sc-service/relImport/importData",
  451. },
  452. // 链属查询参数
  453. queryParams: {
  454. pageNum: 1,
  455. pageSize: 10,
  456. companyName: null,
  457. scySocialCode: null,
  458. scrStatus: null,
  459. scrType: null
  460. },
  461. //未认证列表查询参数
  462. spareParams:{
  463. pageNum: 1,
  464. pageSize: 10,
  465. scySocialCode : null,
  466. companyName : null,
  467. scrType : null
  468. },
  469. //企业列表查询参数
  470. companyQueryParams: {
  471. pageNum: 1,
  472. pageSize: 10,
  473. scyName: null
  474. },
  475. //筛选按钮的数据列表,与table表头的数据一致 --显示隐藏列用
  476. tableList: [
  477. {
  478. label: 'companyCode',
  479. value: '社会统一代码'
  480. },
  481. {
  482. label: 'companyName',
  483. value: '企业名称'
  484. },
  485. {
  486. label: 'companyType',
  487. value: '链属关系'
  488. },
  489. {
  490. label: 'launchScrContarct',
  491. value: '联系人'
  492. },
  493. {
  494. label: 'launchScrContarctPhone',
  495. value: '联系电话'
  496. },
  497. {
  498. label: 'launchScrContarctEmail',
  499. value: '邮箱'
  500. },
  501. {
  502. label: 'launchScrStatus',
  503. value: '状态'
  504. },
  505. ],
  506. checkList: [],//筛选列选中的数据列表--显示隐藏列用
  507. uncheckList: {},//控制筛选列显示隐藏--显示隐藏列用
  508. selfDom : this,
  509. tableId:"/sc-service/rel/list",
  510. // 表单参数
  511. form: {
  512. scyId : null,
  513. scrReceiveType : null,
  514. scyName : null,
  515. scySocialCode : null,
  516. scrContarct : null,
  517. scrContarctPhone : null,
  518. scrContarctEmail : null
  519. },
  520. templateForm:{
  521. scyId : null
  522. },
  523. formDetail:{
  524. scyName : null,
  525. scySocialCode : null,
  526. scyLegal : null,
  527. scyPhone : null
  528. },
  529. companyId:null,
  530. // 表单校验
  531. rules: {
  532. scyName: [
  533. { required: true, message: "公司名称不能为空", trigger: ["blur", "change"] },
  534. ],
  535. scrReceiveType:[
  536. { required: true, message: "链属关系不能为空", trigger: ["blur", "change"] },
  537. ],
  538. scrContarctPhone: [
  539. {
  540. pattern: /^((\d{3}-\d{7,8}|\d{4}-\d{7,8})|(1[3465789]\d{9}))$/,
  541. message: "手机号格式不正确",
  542. trigger: "blur",
  543. }
  544. ],
  545. scySocialCode: [
  546. { required: true, message: "企业统一代码不能为空", trigger: ["blur", "change"] },
  547. {
  548. pattern: /^([0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}|[1-9]\d{14})||([1-9]\d{15})$/,
  549. message: "企业统一代码格式不正确",
  550. trigger: "blur"
  551. }
  552. ],
  553. scrContarctEmail : [
  554. {
  555. pattern:/^([a-z0-9A-Z]+[-|_|\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\.)+[a-zA-Z]{2,}$/,
  556. message: "邮箱格式不正确",
  557. trigger: "blur"
  558. }
  559. ]
  560. },
  561. templateRules: {
  562. scyId:[
  563. { required: true, message: "核心企业不能为空", trigger: "blur" }
  564. ]
  565. },
  566. };
  567. },
  568. activated() {
  569. this.getDicts("sys_scr_status").then(response => {
  570. this.scrStatusOptions = response.data;
  571. });
  572. this.getDicts("sys_scr_type").then(response => {
  573. this.scrTypeOptions = response.data;
  574. });
  575. this.getDicts("sys_scp_status").then(response => {
  576. this.scpStatusOptions = response.data;
  577. });
  578. this.getList();
  579. this.getSpare();
  580. this.getCompanyList();
  581. this.getUser();
  582. },
  583. mounted() {
  584. this.columnQuery();
  585. },
  586. methods: {
  587. //获取当前客户是否之前设置过列展示隐藏
  588. columnQuery(){
  589. //获取页面路径
  590. var psfPagePath = window.location.pathname;
  591. //用请求后台的url作为唯一标识
  592. var psfTableName = this.tableId;
  593. var columnForm = {};
  594. columnForm.psfPagePath = psfPagePath;
  595. columnForm.psfTableName = psfTableName;
  596. columnQuery(columnForm).then(response => {
  597. if(response.data && response.data.psfShowData){
  598. this.checkList = response.data.psfShowData;
  599. }
  600. this.filter();
  601. })
  602. },
  603. //控制隐藏显示的函数
  604. filter(checkList) {
  605. if (!!checkList) {
  606. this.checkList = checkList;
  607. }
  608. columnfilter(this.selfDom);
  609. },
  610. // 菜单状态字典翻译
  611. companyTypeFormat(companyType) {
  612. return this.selectDictLabel(this.scrTypeOptions, companyType);
  613. },
  614. scpTypeFormat(row, column) {
  615. return this.selectDictLabel(this.scrTypeOptions, row.scpType);
  616. },
  617. scpStatusFormat(row, column) {
  618. return this.selectDictLabel(this.scpStatusOptions, row.scpStatus);
  619. },
  620. launchScrStatusFormat(row, column) {
  621. return this.selectDictLabel(this.scrStatusOptions, row.launchScrStatus);
  622. },
  623. //平台导出模板
  624. submitTemplateForm(){
  625. this.$refs["templateForm"].validate(valid => {
  626. let fd = new FormData();
  627. for(var key in self.form){
  628. fd.append(key, self.form[key]);
  629. }
  630. if (valid) {
  631. this.download('/sc-service/relImport/importTemplate', {
  632. ...this.templateForm
  633. }, `链属模板_${new Date().getTime()}.xls`)
  634. this.cancelTemplateForm();
  635. }
  636. })
  637. },
  638. //取消导出模板选择企业
  639. cancelTemplateForm(){
  640. this.templateOpen = false;
  641. this.templateForm = {};
  642. },
  643. /** 导入按钮操作 */
  644. handleImport() {
  645. this.upload.title = "链属导入";
  646. this.upload.open = true;
  647. },
  648. /** 下载模板操作 */
  649. importTemplate() {
  650. this.download('/sc-service/relImport/importTemplate', {
  651. ...this.queryParams
  652. }, `链属模板_${new Date().getTime()}.xls`)
  653. },
  654. /* 平台下载模板操作 */
  655. importAdminTemplate(){
  656. this.templateTitle = "核心企业";
  657. this.templateOpen = true;
  658. },
  659. // 文件上传中处理
  660. handleFileUploadProgress(event, file, fileList) {
  661. this.upload.isUploading = true;
  662. },
  663. // 文件上传成功处理
  664. handleFileSuccess(response, file, fileList) {
  665. this.upload.open = false;
  666. this.upload.isUploading = false;
  667. this.$refs.upload.clearFiles();
  668. this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
  669. this.getList();
  670. this.getSpare();
  671. this.getCompanyList();
  672. },
  673. // 提交上传文件
  674. submitFileForm() {
  675. this.$refs.upload.submit();
  676. },
  677. /** 查询链属列表 */
  678. getList() {
  679. this.loading = true;
  680. listRel(this.queryParams).then(response => {
  681. let list = response.data.records;
  682. this.loginId = response.msg;
  683. for (let i = 0; i < list.length; i++) {
  684. if (list[i].launchCompanyId == response.msg) {
  685. list[i].receive = false;
  686. list[i].launch = true;
  687. }else if(list[i].launchReceiveScrCompanyId == response.msg){
  688. list[i].launch = false;
  689. list[i].receive = true;
  690. }
  691. }
  692. this.companyRelList = list;
  693. console.log(12312313123)
  694. console.log(this.companyRelList)
  695. this.total = response.data.total;
  696. this.loading = false;
  697. }
  698. );
  699. },
  700. // 未认证列表
  701. getSpare() {
  702. this.loading = true;
  703. sparelist(this.spareParams).then(response => {
  704. this.spareOwnlist = response.data.records;
  705. this.spareTitol = response.data.total;
  706. this.loading = false;
  707. }
  708. );
  709. },
  710. //查询所有企业
  711. getCompanyList(){
  712. this.loading = true;
  713. listAllCompany().then(response => {
  714. this.comlist = response.data;
  715. this.listCom = this.comlist.map(item => {
  716. return { value: item.scyId, label: item.scyName };
  717. });
  718. })
  719. },
  720. clearRemote(){
  721. let query = '';
  722. this.form.scyId = '';
  723. this.form.scyName = '';
  724. this.form.scySocialCode = '';
  725. this.idShow = true;
  726. this.remoteMethod(query);
  727. },
  728. //选择企业
  729. remoteMethod(query) {
  730. if (query) {
  731. this.loading = true;
  732. setTimeout(() => {
  733. this.loading = false;
  734. this.companyList = this.listCom.filter(item => {
  735. return item.label.toLowerCase()
  736. .indexOf(query.toLowerCase()) > -1;
  737. });
  738. }, 200);
  739. } else {
  740. this.companyList = [];
  741. }
  742. },
  743. //选择企业后反显
  744. choice(item){
  745. debugger
  746. let scyId = item;
  747. if(scyId){
  748. listCompanyQuery(scyId).then(response => {
  749. if(response.data.length > 0){
  750. this.$set(this.form, "scySocialCode", response.data[0].scySocialCode);
  751. }else{
  752. this.$set(this.form, "scySocialCode", '');
  753. }
  754. if(response.data.length > 0){
  755. this.$set(this.form, "scyId", response.data[0].scyId);
  756. this.idShow = true;
  757. }else{
  758. this.$set(this.form, "scyId", '');
  759. this.idShow = false;
  760. }
  761. })
  762. }
  763. },
  764. // 取消按钮
  765. cancel() {
  766. this.open = false;
  767. this.clearRemote();
  768. this.reset();
  769. },
  770. cancelDetail(){
  771. this.openDetail = false;
  772. this.reset();
  773. },
  774. // 表单重置
  775. reset() {
  776. this.clearRemote();
  777. this.resetForm("form");
  778. this.resetForm("formDetail");
  779. },
  780. /** 搜索按钮操作 */
  781. handleQuery() {
  782. this.queryParams.pageNum = 1;
  783. this.getList();
  784. },
  785. /** 未认证搜索按钮操作 */
  786. handleSpareQuery() {
  787. this.spareParams.pageNum = 1;
  788. this.getSpare();
  789. },
  790. /** 重置按钮操作 */
  791. resetQuery() {
  792. this.resetForm("queryForm");
  793. this.handleQuery();
  794. },
  795. /** 未认证重置按钮操作 */
  796. resetSpareQuery() {
  797. this.resetForm("querySpareForm");
  798. this.handleSpareQuery();
  799. },
  800. /** 新增按钮操作 */
  801. handleAdd() {
  802. this.reset();
  803. this.open = true;
  804. this.title = "新增链属";
  805. },
  806. //查询企业详情
  807. handleCompanyQuery(row){
  808. this.reset();
  809. if(row.receive == true){
  810. const scyId = row.launchCompanyId;
  811. listCompanyQuery(scyId).then(response => {
  812. if(response.data[0].scyStatus == '00'){
  813. Cookies.set("/rel/detailComPany/" + scyId + '/', this.$route.fullPath)
  814. this.$router.push("/rel/detailComPany/" + scyId + '/');
  815. }else{
  816. this.formDetail = response.data[0];
  817. this.openDetail = true;
  818. this.titleDetail = "详情企业信息";
  819. }
  820. });
  821. }else if(row.launch == true){
  822. const scyId = row.launchReceiveScrCompanyId;
  823. listCompanyQuery(scyId).then(response => {
  824. if(response.data[0].scyStatus == '00'){
  825. Cookies.set("/rel/detailComPany/" + scyId + '/', this.$route.fullPath)
  826. this.$router.push("/rel/detailComPany/" + scyId + '/');
  827. }else{
  828. this.formDetail = response.data[0];
  829. this.openDetail = true;
  830. this.titleDetail = "详情企业信息";
  831. }
  832. });
  833. }
  834. },
  835. /** 提交按钮 */
  836. submitForm() {
  837. var self = this;
  838. this.$refs["form"].validate(valid => {
  839. let fd = new FormData();
  840. for(var key in self.form){
  841. fd.append(key, self.form[key]);
  842. }
  843. if (valid) {
  844. const loading = this.$loading({
  845. lock: true,
  846. text: "Loading",
  847. spinner: "el-icon-loading",
  848. background: "rgba(0, 0, 0, 0.7)",
  849. })
  850. for (var company of this.companyList) {
  851. if (company.value == self.form.scyId) {
  852. self.form.scyName = company.label;
  853. break;
  854. }
  855. }
  856. console.log(self.form,"提交表单")
  857. addRel(self.form).then(response => {
  858. this.msgSuccess("新增成功");
  859. this.open = false;
  860. this.getList();
  861. this.getSpare();
  862. this.getCompanyList();
  863. });
  864. loading.close();
  865. }
  866. });
  867. },
  868. /* 同意链属 */
  869. handleSuccess(row){
  870. const launchScrId = row.launchScrId || this.ids;
  871. if (row.launchCompanyId == this.loginId) {
  872. const scyName = row.receiveScyName;
  873. this.$confirm('确认与"' + scyName + '"的链属关系?', "警告", {
  874. confirmButtonText: "确定",
  875. cancelButtonText: "取消",
  876. type: "warning"
  877. }).then(function() {
  878. const state = "01";
  879. return updateRel(launchScrId,state);
  880. }).then(() => {
  881. this.msgSuccess("链属成功");
  882. this.getList();
  883. this.getSpare();
  884. this.getCompanyList();
  885. })
  886. .catch(() => {
  887. this.$message({
  888. type: "warning",
  889. message: "已取消链属",
  890. });
  891. });
  892. }else if(row.launchReceiveScrCompanyId == this.loginId){
  893. const scyName = row.launchScyName;
  894. this.$confirm('确认与"' + scyName + '"的链属关系?', "警告", {
  895. confirmButtonText: "确定",
  896. cancelButtonText: "取消",
  897. type: "warning"
  898. }).then(function() {
  899. const state = "01";
  900. return updateRel(launchScrId,state);
  901. }).then(() => {
  902. this.msgSuccess("链属成功");
  903. this.getList();
  904. this.getSpare();
  905. this.getCompanyList();
  906. })
  907. .catch(() => {
  908. this.$message({
  909. type: "warning",
  910. message: "已取消链属",
  911. });
  912. });
  913. }
  914. },
  915. /* 拒绝链属 */
  916. handleRefuse(row){
  917. const launchScrId = row.launchScrId || this.ids;
  918. if (row.launchCompanyId == this.loginId) {
  919. const scyName = row.receiveScyName;
  920. this.$confirm('拒绝与"' + scyName + '"的链属关系?', "警告", {
  921. confirmButtonText: "确定",
  922. cancelButtonText: "取消",
  923. type: "warning"
  924. }).then(function() {
  925. const state = "02";
  926. return updateRel(launchScrId,state);
  927. }).then(() => {
  928. this.msgSuccess("拒绝成功");
  929. this.getList();
  930. this.getSpare();
  931. this.getCompanyList();
  932. })
  933. .catch(() => {
  934. this.$message({
  935. type: "warning",
  936. message: "已拒绝链属",
  937. });
  938. });
  939. }else if(row.launchReceiveScrCompanyId == this.loginId){
  940. const scyName = row.launchScyName;
  941. this.$confirm('拒绝与"' + scyName + '"的链属关系?', "警告", {
  942. confirmButtonText: "确定",
  943. cancelButtonText: "取消",
  944. type: "warning"
  945. }).then(function() {
  946. const state = "02";
  947. return updateRel(launchScrId,state);
  948. }).then(() => {
  949. this.msgSuccess("拒绝成功");
  950. this.getList();
  951. this.getSpare();
  952. this.getCompanyList();
  953. })
  954. .catch(() => {
  955. this.$message({
  956. type: "warning",
  957. message: "已拒绝链属",
  958. });
  959. });
  960. }
  961. },
  962. /** 解绑按钮操作 */
  963. handleDelete(row) {
  964. const launchScrId = row.launchScrId || this.ids;
  965. if (row.launchCompanyId == this.loginId) {
  966. const scyName = row.receiveScyName;
  967. this.$confirm('是否确认解绑与"' + scyName + '"的链属关系?', "警告", {
  968. confirmButtonText: "确定",
  969. cancelButtonText: "取消",
  970. type: "warning"
  971. }).then(function() {
  972. return delRel(launchScrId);
  973. }).then(() => {
  974. this.msgSuccess("解绑成功");
  975. this.getList();
  976. this.getSpare();
  977. this.getCompanyList();
  978. })
  979. .catch(() => {
  980. this.$message({
  981. type: "warning",
  982. message: "已取消解绑",
  983. });
  984. });
  985. }else if(row.launchReceiveScrCompanyId == this.loginId){
  986. const scyName = row.launchScyName;
  987. this.$confirm('是否确认解绑与"' + scyName + '"的链属关系?', "警告", {
  988. confirmButtonText: "确定",
  989. cancelButtonText: "取消",
  990. type: "warning"
  991. }).then(function() {
  992. return delRel(launchScrId);
  993. }).then(() => {
  994. this.msgSuccess("解绑成功");
  995. this.getList();
  996. this.getSpare();
  997. this.getCompanyList();
  998. })
  999. .catch(() => {
  1000. this.$message({
  1001. type: "warning",
  1002. message: "已取消解绑",
  1003. });
  1004. });
  1005. }
  1006. },
  1007. /* 解绑链属企业信息数据 */
  1008. handleSpareDelete(row) {
  1009. const scpId = row.scpId || this.ids;
  1010. const scpName = row.scpName;
  1011. this.$confirm('是否确认解绑"' + scpName + '"的信息?', "警告", {
  1012. confirmButtonText: "确定",
  1013. cancelButtonText: "取消",
  1014. type: "warning"
  1015. }).then(function() {
  1016. return removeSpare(scpId);
  1017. }).then(() => {
  1018. this.getSpare();
  1019. this.msgSuccess("解绑成功");
  1020. })
  1021. .catch(() => {
  1022. this.$message({
  1023. type: "warning",
  1024. message: "已取消解绑",
  1025. });
  1026. });
  1027. },
  1028. //重邀操作
  1029. handleInvite(row){
  1030. const loading = this.$loading({
  1031. lock: true,
  1032. text: "Loading",
  1033. spinner: "el-icon-loading",
  1034. background: "rgba(0, 0, 0, 0.7)",
  1035. })
  1036. againInvite(row).then(response => {
  1037. this.getList();
  1038. this.getSpare();
  1039. this.getCompanyList();
  1040. }).then(() => {
  1041. this.msgSuccess("重邀成功");
  1042. this.getList();
  1043. this.getSpare();
  1044. this.getCompanyList();
  1045. loading.close();
  1046. }).catch((e) => {
  1047. loading.close();
  1048. });
  1049. },
  1050. //获取操作员Id
  1051. getUser(){
  1052. getUser().then(response => {
  1053. this.userId = response.data.userId;
  1054. this.scyTypeNow = response.data.scyType;
  1055. if(this.scyTypeNow == '01'){
  1056. this.handleRel = true;
  1057. }else {
  1058. this.handleRel = false;
  1059. }
  1060. })
  1061. }
  1062. }
  1063. };
  1064. </script>