supCompanyManage.vue 19 KB

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