supCompanyManage.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. <template>
  2. <div class="app-container zap-main">
  3. <search-bar
  4. :checkList="checkList"
  5. :tableList="tableList"
  6. :selfDom="selfDom"
  7. :tableId="tableId"
  8. @query="handleQuery"
  9. @reset="resetQuery">
  10. <el-form
  11. :model="queryParams"
  12. ref="queryForm"
  13. :inline="true"
  14. v-show="showSearch"
  15. label-width="auto"
  16. >
  17. <el-form-item label="企业名称" prop="scyName">
  18. <el-input
  19. maxlength="30"
  20. v-model="queryParams.scyName"
  21. placeholder="请输入企业名称"
  22. clearable
  23. @keyup.enter.native="handleQuery"
  24. />
  25. </el-form-item>
  26. <el-form-item label="社会统一代码" prop="scySocialCode">
  27. <el-input
  28. v-model="queryParams.scySocialCode"
  29. maxlength="30"
  30. placeholder="请输入社会统一代码"
  31. clearable
  32. @keyup.enter.native="handleQuery"
  33. />
  34. </el-form-item>
  35. <el-form-item label="联系人" prop="nickName">
  36. <el-input
  37. v-model="queryParams.nickName"
  38. maxlength="30"
  39. placeholder="请输入联系人"
  40. clearable
  41. @keyup.enter.native="handleQuery"
  42. />
  43. </el-form-item>
  44. <el-form-item label="联系电话" prop="userName">
  45. <el-input
  46. v-model="queryParams.userName"
  47. maxlength="11"
  48. placeholder="请输入联系电话"
  49. clearable
  50. @keyup.enter.native="handleQuery"
  51. />
  52. </el-form-item>
  53. <el-form-item label="企业状态" prop="scyStatus">
  54. <el-select v-model="queryParams.scyStatus" placeholder="企业状态" clearable>
  55. <el-option
  56. v-for="dict in scyStatusOptions"
  57. :key="dict.dictValue"
  58. :label="dict.dictLabel"
  59. :value="dict.dictValue"
  60. ></el-option>
  61. </el-select>
  62. </el-form-item>
  63. </el-form>
  64. </search-bar>
  65. <el-row class="zap-form zap-margin-top">
  66. <el-table
  67. style="margin-top: 20px;"
  68. v-loading="loading"
  69. :data="companyList"
  70. @selection-change="handleSelectionChange"
  71. stripe
  72. border
  73. >
  74. <el-table-column label="序号" type="index" width="50" align="center">
  75. <template slot-scope="scope">
  76. <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
  77. </template>
  78. </el-table-column>
  79. <el-table-column
  80. label="企业名称"
  81. align="center"
  82. prop="scyName"
  83. :show-overflow-tooltip="true"
  84. v-if="uncheckList.scyName"
  85. />
  86. <el-table-column
  87. label="社会统一代码"
  88. align="center"
  89. prop="scySocialCode"
  90. v-if="uncheckList.scySocialCode"
  91. />
  92. <el-table-column label="联系人" align="center" prop="nickName" v-if="uncheckList.nickName" />
  93. <el-table-column label="联系电话" align="center" prop="userName" v-if="uncheckList.userName" />
  94. <el-table-column
  95. label="四要素状态"
  96. align="center"
  97. prop="scyAuthStatus"
  98. :formatter="scyAuthStatusFormat"
  99. v-if="uncheckList.scyAuthStatus"
  100. />
  101. <el-table-column
  102. label="状态"
  103. align="center"
  104. prop="scyStatus"
  105. :formatter="scyStatusFormat"
  106. v-if="uncheckList.scyStatus"
  107. />
  108. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
  109. <template slot-scope="scope">
  110. <el-button
  111. v-if="scope.row.scyAuthStatus == '00' || scope.row.scyStatus == '00' || scope.row.scyStatus == '01'"
  112. class="zap-button-plain"
  113. size="mini"
  114. @click="handleDetail(scope.row)"
  115. v-hasPermi="['service:company:query']"
  116. >详情</el-button>
  117. <el-button
  118. v-if="scope.row.scyStatus == '00' && (scope.row.scyAuthStatus == '00' || scope.row.scyAuthStatus == '02')"
  119. class="zap-button-primary"
  120. size="mini"
  121. @click="handleExamine(scope.row)"
  122. v-hasPermi="['service:company:elementStatus']"
  123. >四要素审核</el-button>
  124. <el-button
  125. v-if="scope.row.scyAuthStatus == '00'"
  126. class="zap-button-success"
  127. size="mini"
  128. @click="handleUpdate(scope.row)"
  129. v-hasPermi="['service:company:update']"
  130. >修改</el-button>
  131. <el-button
  132. v-if="scope.row.scyStatus == '00'"
  133. class="zap-button-confirmation"
  134. size="mini"
  135. @click="handleCompanyFrozen(scope.row)"
  136. v-hasPermi="['service:company:updateCompanyStatus']"
  137. >冻结</el-button>
  138. <el-button
  139. v-if="scope.row.scyStatus == '01'"
  140. class="zap-button-primary"
  141. size="mini"
  142. @click="handleCompanyStatus(scope.row)"
  143. v-hasPermi="['service:company:updateCompanyStatus']"
  144. >解冻</el-button>
  145. <el-button
  146. v-if="scope.row.scyStatus != '00'"
  147. class="zap-button-confirmation"
  148. size="mini"
  149. @click="handleDelete(scope.row)"
  150. v-hasPermi="['service:company:delete']"
  151. >删除</el-button>
  152. <el-button
  153. v-if="scope.row.scyStatus == '00'"
  154. class="zap-button-primary"
  155. size="mini"
  156. @click="handleToCore(scope.row)"
  157. v-hasPermi="['service:company:companyToCore']"
  158. >改为核心企业</el-button>
  159. </template>
  160. </el-table-column>
  161. </el-table>
  162. <pagination
  163. v-show="total>0"
  164. :total="total"
  165. :page.sync="queryParams.pageNum"
  166. :limit.sync="queryParams.pageSize"
  167. @pagination="getList"
  168. />
  169. </el-row>
  170. <!-- 添加或修改公司对话框 -->
  171. <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
  172. <el-form ref="form" :model="form" :rules="rules" label-width="140px" :inline="true">
  173. <el-form-item label="企业名称" prop="scyName">
  174. <el-input
  175. v-model="form.scyName"
  176. placeholder="请输入企业名称"
  177. style="width:560px"
  178. maxlength="20"
  179. show-word-limit
  180. />
  181. </el-form-item>
  182. <el-form-item label="企业统一代码" prop="scySocialCode">
  183. <el-input
  184. v-model="form.scySocialCode"
  185. placeholder="请输入企业统一代码"
  186. maxlength="18"
  187. show-word-limit
  188. />
  189. </el-form-item>
  190. <el-form-item label="联系人" prop="nickMame">
  191. <el-input v-model="form.nickMame" placeholder="请输入联系人" maxlength="5" show-word-limit />
  192. </el-form-item>
  193. <el-form-item label="联系人手机号" prop="userName">
  194. <el-input v-model="form.userName" disabled maxlength="11" show-word-limit />
  195. </el-form-item>
  196. </el-form>
  197. <div slot="footer" class="dialog-footer">
  198. <el-button type="primary" @click="submitForm">确 定</el-button>
  199. <el-button @click="cancel">取 消</el-button>
  200. </div>
  201. </el-dialog>
  202. <!-- 详情公司对话框 -->
  203. <el-dialog :title="title" :visible.sync="openDetail" width="800px" append-to-body>
  204. <el-form ref="form" :model="form" :rules="rules" label-width="140px" :inline="true">
  205. <el-form-item label="企业名称" prop="scyName">
  206. <el-input
  207. v-model="form.scyName"
  208. disabled
  209. style="width:560px"
  210. maxlength="20"
  211. show-word-limit
  212. />
  213. </el-form-item>
  214. <el-form-item label="企业统一代码" prop="scySocialCode">
  215. <el-input v-model="form.scySocialCode" disabled maxlength="18" show-word-limit />
  216. </el-form-item>
  217. <el-form-item label="联系人" prop="nickName">
  218. <el-input v-model="form.nickName" disabled maxlength="5" show-word-limit />
  219. </el-form-item>
  220. <el-form-item label="联系人手机号" prop="userName">
  221. <el-input v-model="form.userName" disabled maxlength="11" show-word-limit />
  222. </el-form-item>
  223. </el-form>
  224. <div slot="footer" class="dialog-footer">
  225. <el-button @click="cancel">取 消</el-button>
  226. </div>
  227. </el-dialog>
  228. <!-- 四要素审核 -->
  229. <el-dialog :title="examTitle" :visible.sync="examOpen" width="400px" append-to-body>
  230. <el-form
  231. ref="examForm"
  232. :model="examForm"
  233. :rules="examRules"
  234. label-width="140px"
  235. :inline="true"
  236. >
  237. <template>
  238. <el-radio v-model="examForm.state" label="03">通过</el-radio>
  239. <el-radio v-model="examForm.state" label="04">拒绝</el-radio>
  240. </template>
  241. </el-form>
  242. <div slot="footer" class="dialog-footer">
  243. <el-button type="primary" @click="examSubmit">确 定</el-button>
  244. <el-button @click="examCancel">取 消</el-button>
  245. </div>
  246. </el-dialog>
  247. </div>
  248. </template>
  249. <script>
  250. import {
  251. listCompany,
  252. companyQuery,
  253. addCompany,
  254. updateCompany,
  255. updateCompanyStatus,
  256. getElementStatus,
  257. removeCompany,
  258. companyToCore
  259. } from "@/api/service/company/company";
  260. import { uploadFileNew } from "@/api/common/file";
  261. import { getToken } from "@/utils/auth";
  262. import { columnQuery, columnfilter } from "@/api/common/columnSetting";
  263. import ColumnSetting from "../../../components/Table/columnSetting.vue";
  264. import Cookies from "js-cookie";
  265. export default {
  266. name: "supCompanyManage",
  267. components: {
  268. ColumnSetting
  269. },
  270. data() {
  271. return {
  272. //四要素审核相关
  273. examTitle: "",
  274. examOpen: false,
  275. examForm: {
  276. scyId: null,
  277. state: null
  278. },
  279. examRules: {
  280. state: [
  281. { required: true, message: "审核状态不能为空", trigger: "blur" }
  282. ]
  283. },
  284. // 遮罩层
  285. loading: true,
  286. // 选中数组
  287. ids: [],
  288. // 非单个禁用
  289. single: true,
  290. // 非多个禁用
  291. multiple: true,
  292. // 显示搜索条件
  293. showSearch: true,
  294. // 总条数
  295. total: 0,
  296. // 公司表格数据
  297. companyList: [],
  298. scyAuthStatusOptions: [],
  299. scyStatusOptions: [],
  300. // 弹出层标题
  301. title: "",
  302. // 是否显示弹出层
  303. open: false,
  304. openDetail: false,
  305. // 查询参数
  306. queryParams: {
  307. pageNum: 1,
  308. pageSize: 10,
  309. scyName: null,
  310. scySocialCode: null,
  311. nickName: null,
  312. userName: null,
  313. scyStatus: null,
  314. scyType: "02" //供应商
  315. },
  316. //筛选按钮的数据列表,与table表头的数据一致 --显示隐藏列用
  317. tableList: [
  318. {
  319. label: "scyId",
  320. value: "企业编号"
  321. },
  322. {
  323. label: "scyName",
  324. value: "企业名称"
  325. },
  326. {
  327. label: "scySocialCode",
  328. value: "社会统一代码"
  329. },
  330. {
  331. label: "nickName",
  332. value: "联系人"
  333. },
  334. {
  335. label: "userName",
  336. value: "联系电话"
  337. },
  338. {
  339. label: "scyAuthStatus",
  340. value: "四要素状态"
  341. },
  342. {
  343. label: "scyStatus",
  344. value: "状态"
  345. }
  346. ],
  347. checkList: [], //筛选列选中的数据列表--显示隐藏列用
  348. uncheckList: {}, //控制筛选列显示隐藏--显示隐藏列用
  349. selfDom: this,
  350. tableId: "/sc-service/company/list",
  351. // 表单参数
  352. form: {},
  353. // 表单校验
  354. rules: {
  355. scyName: [
  356. {
  357. required: true,
  358. message: "企业名称不能为空",
  359. trigger: ["blur", "change"]
  360. },
  361. {
  362. pattern: /^([\u4e00-\u9fa5]+|[a-zA-Z0-9]+)$/,
  363. message: "企业名称不能含有特殊字符",
  364. trigger: ["blur", "change"]
  365. }
  366. ],
  367. nickName: [
  368. {
  369. required: true,
  370. message: "联系人不能为空",
  371. trigger: ["blur", "change"]
  372. },
  373. {
  374. pattern: /^([\u4e00-\u9fa5]+|[a-zA-Z0-9]+)$/,
  375. message: "联系人不能含有特殊字符",
  376. trigger: ["blur", "change"]
  377. }
  378. ],
  379. userName: [
  380. {
  381. required: true,
  382. message: "联系人手机号不能为空",
  383. trigger: ["blur", "change"]
  384. },
  385. {
  386. pattern: /^((\d{3}-\d{7,8}|\d{4}-\d{7,8})|(1[3465789]\d{9}))$/,
  387. message: "手机号格式不正确",
  388. trigger: ["blur", "change"]
  389. }
  390. ],
  391. scySocialCode: [
  392. { required: true, message: "企业统一代码不能为空", trigger: "blur" },
  393. {
  394. pattern: /^([0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}|[1-9]\d{14})$/,
  395. message: "企业统一代码格式不正确",
  396. trigger: ["blur", "change"]
  397. }
  398. ]
  399. }
  400. };
  401. },
  402. activated() {
  403. this.getList();
  404. this.getDicts("ser_scy_status").then(response => {
  405. this.scyStatusOptions = response.data;
  406. });
  407. this.getDicts("ser_scy_authStatus").then(response => {
  408. this.scyAuthStatusOptions = response.data;
  409. });
  410. },
  411. mounted() {
  412. this.columnQuery();
  413. },
  414. methods: {
  415. //获取当前客户是否之前设置过列展示隐藏
  416. columnQuery() {
  417. //获取页面路径
  418. var psfPagePath = window.location.pathname;
  419. //用请求后台的url作为唯一标识
  420. var psfTableName = this.tableId;
  421. var columnForm = {};
  422. columnForm.psfPagePath = psfPagePath;
  423. columnForm.psfTableName = psfTableName;
  424. columnQuery(columnForm).then(response => {
  425. if (response.data && response.data.psfShowData) {
  426. this.checkList = response.data.psfShowData;
  427. }
  428. this.filter();
  429. });
  430. },
  431. //控制隐藏显示的函数
  432. filter(checkList) {
  433. if (!!checkList) {
  434. this.checkList = checkList;
  435. }
  436. columnfilter(this.selfDom);
  437. },
  438. /** 查询公司列表 */
  439. getList() {
  440. this.loading = true;
  441. listCompany(this.queryParams).then(response => {
  442. this.companyList = response.data.records;
  443. this.total = response.data.total;
  444. this.loading = false;
  445. });
  446. },
  447. // 取消按钮
  448. cancel() {
  449. this.open = false;
  450. (this.openDetail = false), this.reset();
  451. },
  452. // 表单重置
  453. reset() {
  454. this.form = {
  455. scyName: null,
  456. scySocialCode: null,
  457. scyLegal: null,
  458. scyPhone: null
  459. };
  460. this.resetForm("form");
  461. },
  462. /** 搜索按钮操作 */
  463. handleQuery() {
  464. this.queryParams.pageNum = 1;
  465. this.getList();
  466. },
  467. /** 重置按钮操作 */
  468. resetQuery() {
  469. this.resetForm("queryForm");
  470. this.handleQuery();
  471. },
  472. /* 企业详情 */
  473. handleDetail(row) {
  474. this.reset();
  475. this.resetForm("queryForm");
  476. let scyId = row.scyId || this.ids;
  477. let scyAuthStatus = row.scyAuthStatus || this.ids;
  478. let scyStatus = row.scyStatus || this.ids;
  479. if (scyStatus == "00") {
  480. Cookies.set(
  481. "/company/detailComPany/" + scyId + "/",
  482. this.$route.fullPath
  483. );
  484. this.$router.push("/company/detailComPany/" + scyId + "/");
  485. } else if (scyAuthStatus == "00" || scyStatus == "01") {
  486. companyQuery(scyId).then(response => {
  487. this.form = response.data[0];
  488. this.openDetail = true;
  489. this.title = "详情企业信息";
  490. });
  491. }
  492. },
  493. /* 冻结 */
  494. handleCompanyFrozen(row) {
  495. const scyId = row.scyId || this.ids;
  496. const scyName = row.scyName;
  497. const state = "01";
  498. this.$confirm('是否确认冻结公司名称为"' + scyName + '"的数据?', "警告", {
  499. confirmButtonText: "确定",
  500. cancelButtonText: "取消",
  501. type: "warning"
  502. })
  503. .then(function() {
  504. return updateCompanyStatus(scyId, state);
  505. })
  506. .then(() => {
  507. this.getList();
  508. this.msgSuccess("冻结成功");
  509. })
  510. .catch(c => {
  511. if (c == "cancel") {
  512. this.$message({
  513. type: "warning",
  514. message: "已取消冻结"
  515. });
  516. }
  517. });
  518. },
  519. /* 解冻 */
  520. handleCompanyStatus(row) {
  521. const scyId = row.scyId || this.ids;
  522. const scyName = row.scyName;
  523. const state = "00";
  524. this.$confirm('是否确认解冻公司名称为"' + scyName + '"的数据?', "警告", {
  525. confirmButtonText: "确定",
  526. cancelButtonText: "取消",
  527. type: "warning"
  528. })
  529. .then(function() {
  530. return updateCompanyStatus(scyId, state);
  531. })
  532. .then(() => {
  533. this.getList();
  534. this.msgSuccess("解冻成功");
  535. })
  536. .catch(() => {
  537. this.$message({
  538. type: "warning",
  539. message: "已取消解冻"
  540. });
  541. });
  542. },
  543. //四要素审核
  544. handleExamine(row) {
  545. this.reset();
  546. this.resetForm("queryForm");
  547. const scyId = row.scyId || this.ids;
  548. Cookies.set(
  549. "/company/detailComPanyExam/" + scyId + "/",
  550. this.$route.fullPath
  551. );
  552. this.$router.push("/company/detailComPanyExam/" + scyId + "/");
  553. },
  554. /** 删除按钮操作 */
  555. handleDelete(row) {
  556. const scyId = row.scyId || this.ids;
  557. const scyName = row.scyName;
  558. this.$confirm('是否确认删除企业名称为"' + scyName + '"的数据?', "警告", {
  559. confirmButtonText: "确定",
  560. cancelButtonText: "取消",
  561. type: "warning"
  562. })
  563. .then(function() {
  564. return removeCompany(scyId);
  565. })
  566. .then(() => {
  567. this.getList();
  568. this.msgSuccess("删除成功");
  569. })
  570. .catch(() => {
  571. this.$message({
  572. type: "warning",
  573. message: "已取消删除"
  574. });
  575. });
  576. },
  577. /** 更改为核心企业 */
  578. handleToCore(row) {
  579. const scyId = row.scyId || this.ids;
  580. const scyName = row.scyName;
  581. this.$confirm(
  582. '确认把名称为"' + scyName + '"的企业改为核心企业?',
  583. "警告",
  584. {
  585. confirmButtonText: "确定",
  586. cancelButtonText: "取消",
  587. type: "warning"
  588. }
  589. )
  590. .then(function() {
  591. return companyToCore(scyId);
  592. })
  593. .then(() => {
  594. this.getList();
  595. this.msgSuccess("更改成功");
  596. })
  597. .catch(() => {
  598. this.$message({
  599. type: "warning",
  600. message: "已取消更改"
  601. });
  602. });
  603. },
  604. scyStatusFormat(row, column) {
  605. if (
  606. row.scyStatus == "02" ||
  607. row.scyStatus == "03" ||
  608. row.scyStatus == "04"
  609. ) {
  610. return this.selectDictLabel(this.scyStatusOptions, "02");
  611. } else {
  612. return this.selectDictLabel(this.scyStatusOptions, row.scyStatus);
  613. }
  614. },
  615. scyAuthStatusFormat(row, column) {
  616. return this.selectDictLabel(this.scyAuthStatusOptions, row.scyAuthStatus);
  617. }
  618. }
  619. };
  620. </script>