supCompanyManage.vue 19 KB

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