index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
  4. <el-form-item label="团队名称" label-width="70px">
  5. <el-input
  6. v-model="queryParams.name"
  7. placeholder="请输入团队名称"
  8. clearable
  9. style="width: 140px;"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="团队类型">
  14. <el-select
  15. v-model="queryParams.type"
  16. placeholder="团队类型"
  17. clearable
  18. style="width: 240px"
  19. >
  20. <el-option
  21. v-for="dict in dict.type.team_type"
  22. :key="dict.value"
  23. :label="dict.label"
  24. :value="dict.value"
  25. />
  26. </el-select>
  27. </el-form-item>
  28. <el-form-item label="销售员" label-width="70px">
  29. <el-input
  30. v-model="queryParams.salerPerson"
  31. placeholder="请输入销售员"
  32. clearable
  33. style="width: 140px;"
  34. @keyup.enter.native="handleQuery"
  35. />
  36. </el-form-item>
  37. <el-form-item label="创建人" label-width="70px">
  38. <el-input
  39. v-model="queryParams.createBy"
  40. placeholder="请输入创建人"
  41. clearable
  42. style="width: 140px;"
  43. @keyup.enter.native="handleQuery"
  44. />
  45. </el-form-item>
  46. <el-form-item>
  47. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  48. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  49. </el-form-item>
  50. </el-form>
  51. <el-row :gutter="10" class="mb8">
  52. <el-col :span="1.5">
  53. <el-button
  54. type="primary"
  55. plain
  56. icon="el-icon-plus"
  57. size="mini"
  58. @click="handleAdd"
  59. v-hasPermi="['teamMr:teamMr:add']"
  60. >新增</el-button>
  61. </el-col>
  62. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  63. </el-row>
  64. <el-table ref="tables" v-loading="loading" :data="dataList" border>
  65. <el-table-column label="序号" align="center" type="index" width="50"></el-table-column>
  66. <el-table-column label="团队名称" align="center" prop="name" />
  67. <el-table-column label="团队类型" align="center" prop="type">
  68. <template slot-scope="scope">
  69. <dict-tag :options="dict.type.team_type" :value="scope.row.type"/>
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="客户负责人" align="center" prop="contact" />
  73. <el-table-column label="客户账号/联系电话" align="center" prop="mobile" />
  74. <el-table-column label="销售员" align="center" prop="salerPerson" />
  75. <el-table-column label="销售员联系电话" align="center" prop="salerMobile" />
  76. <el-table-column label="合约信息" align="center" prop="type">
  77. <template slot-scope="scope">
  78. <el-button type="text" @click="seeCenter(scope.row, 'img')">查看</el-button>
  79. </template>
  80. </el-table-column>
  81. <el-table-column label="账户余额" align="center" prop="balance" />
  82. <el-table-column label="授信额度" align="center" prop="grantQuota" />
  83. <el-table-column label="授信余额" align="center" prop="grantSurplus" />
  84. <el-table-column label="授信欠款" align="center" prop="grantUsed" />
  85. <el-table-column label="账户状态" align="center" prop="status">
  86. <template slot-scope="scope">
  87. <el-switch
  88. @change="updateStatusApi(scope.row)"
  89. v-model="scope.row.switchValue"
  90. :active-value="1"
  91. active-color="#13ce66"
  92. inactive-color="#ff4949">
  93. </el-switch>
  94. </template>
  95. </el-table-column>
  96. <el-table-column label="创建人" align="center" prop="createBy" />
  97. <el-table-column label="创建时间" align="center" prop="createTime">
  98. <template slot-scope="scope">
  99. <span>{{ parseTime(scope.row.createTime) }}</span>
  100. </template>
  101. </el-table-column>
  102. <el-table-column label="审核状态" align="center" prop="checkStatus">
  103. <template slot-scope="scope">
  104. <el-tag type="info" v-if="scope.row.checkStatus == 0">待审核</el-tag>
  105. <el-tag type="success" v-if="scope.row.checkStatus == 1">审核成功</el-tag>
  106. <el-popover
  107. placement="top-start"
  108. width="200"
  109. trigger="hover"
  110. :content="'驳回原因:'+scope.row.checkRemark">
  111. <el-tag slot="reference" type="danger" v-if="scope.row.checkStatus == 2">审核不通过</el-tag>
  112. </el-popover>
  113. </template>
  114. </el-table-column>
  115. <el-table-column label="审核时间" align="center" prop="checkTime" />
  116. <el-table-column label="审核人" align="center" prop="checkBy" />
  117. <el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
  118. <template slot-scope="scope">
  119. <el-button
  120. size="mini"
  121. type="text"
  122. @click="handleAudit(scope.row,'details')"
  123. v-hasPermi="['teamMr:teamMr:edit']"
  124. >详情</el-button>
  125. <el-button
  126. size="mini"
  127. type="text"
  128. @click="handleAudit(scope.row,'Audit')"
  129. v-hasPermi="['teamMr:teamMr:edit']"
  130. v-if="scope.row.checkStatus == 0 && name!=scope.row.createBy"
  131. >审核</el-button>
  132. <el-button
  133. size="mini"
  134. type="text"
  135. @click="handleUpdate(scope.row)"
  136. v-hasPermi="['teamMr:teamMr:edit']"
  137. v-if="scope.row.checkStatus == 1 && name!=scope.row.createBy"
  138. >编辑</el-button>
  139. <el-button
  140. size="mini"
  141. type="text"
  142. @click="handleUpdate(scope.row)"
  143. v-hasPermi="['teamMr:teamMr:edit']"
  144. v-if="scope.row.checkStatus == 2 && name==scope.row.createBy"
  145. >修改重新提交</el-button>
  146. <el-button
  147. size="mini"
  148. type="text"
  149. @click="handleDelete(scope.row,scope.index)"
  150. v-hasPermi="['teamMr:teamMr:delete']"
  151. v-if="(scope.row.checkStatus == 1 && name!=scope.row.createBy)||scope.row.checkStatus != 1"
  152. >删除</el-button>
  153. <el-dropdown v-if="scope.row.checkStatus == 1" size="mini" @command="(command) => handleCommand(command, scope.row,scope.index)">
  154. <el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
  155. <el-dropdown-menu slot="dropdown">
  156. <el-dropdown-item command="handleResetPwd" icon="el-icon-key"
  157. v-hasPermi="['teamMr:teamMr:resetting']">重置密码</el-dropdown-item>
  158. <el-dropdown-item command="rechargeBox" icon="el-icon-key"
  159. v-if="scope.row.checkStatus == 1 && name!=scope.row.createBy"
  160. >账户充值</el-dropdown-item>
  161. <el-dropdown-item command="creditGranting" icon="el-icon-circle-check"
  162. v-if="scope.row.checkStatus == 1 && name!=scope.row.createBy"
  163. >账户授信余额</el-dropdown-item>
  164. <el-dropdown-item command="creditGrantingBox" icon="el-icon-circle-check"
  165. v-if="scope.row.checkStatus == 1 && name!=scope.row.createBy"
  166. >账户授信欠款</el-dropdown-item>
  167. </el-dropdown-menu>
  168. </el-dropdown>
  169. </template>
  170. </el-table-column>
  171. </el-table>
  172. <pagination
  173. v-show="total>0"
  174. :total="total"
  175. :page.sync="queryParams.pageNum"
  176. :limit.sync="queryParams.pageSize"
  177. @pagination="getList"
  178. />
  179. <!-- 新增/编辑弹框 -->
  180. <add-and-edit
  181. ref="addAndEdit"
  182. :dict="dict"
  183. @getList="getList"
  184. />
  185. <!-- 账户充值 -->
  186. <rechargeBox
  187. ref="rechargeBox"
  188. @getList="getList"
  189. />
  190. <!-- 账户授信余额 -->
  191. <creditGranting
  192. ref="creditGranting"
  193. @getList="getList"
  194. />
  195. <!-- 账户授信余额 -->
  196. <creditGrantingBox
  197. ref="creditGrantingBox"
  198. @getList="getList"
  199. />
  200. <!-- 详情 / 审核 -->
  201. <auditBox ref="auditBox" :dict="dict" @getList="getList" />
  202. <el-dialog
  203. title="查看"
  204. :visible.sync="visibleStatus"
  205. width="600px"
  206. :destroy-on-close="true"
  207. :close-on-click-modal="false"
  208. >
  209. <div v-if="visibleType == 'img'">
  210. <el-image
  211. style="width: 400px; height: 100%"
  212. v-for="(item, index) in newObj.contractImgList"
  213. :key="index"
  214. :src="item"
  215. fit="cover"
  216. />
  217. </div>
  218. <div v-if="visibleType == 'html'">
  219. <div v-html="newObj.centent"></div>
  220. </div>
  221. <div slot="footer" class="dialog-footer">
  222. <el-button type="primary" @click="visibleStatus = false">确 定</el-button>
  223. </div>
  224. </el-dialog>
  225. </div>
  226. </template>
  227. <script>
  228. import { pageList, deleteById, updateStatus } from '@/api/team/teamMr'
  229. import addAndEdit from "./dialog/addAndEdit.vue";
  230. import creditGranting from './dialog/creditGranting.vue';
  231. import rechargeBox from './dialog/rechargeBox.vue';
  232. import auditBox from './dialog/auditBox.vue';
  233. import creditGrantingBox from './dialog/creditGrantingBox.vue';
  234. import { mapGetters } from 'vuex'
  235. export default {
  236. name: "agreement",
  237. dicts: ['team_type'],
  238. components: { addAndEdit, creditGranting, rechargeBox, auditBox, creditGrantingBox },
  239. data() {
  240. return {
  241. // 遮罩层
  242. loading: true,
  243. // 选中数组
  244. ids: [],
  245. // 非单个禁用
  246. single: true,
  247. // 非多个禁用
  248. multiple: true,
  249. // 显示搜索条件
  250. showSearch: true,
  251. // 总条数
  252. total: 0,
  253. // 用户表格数据
  254. dataList: null,
  255. // 弹出层标题
  256. title: "",
  257. // 是否显示弹出层
  258. open: false,
  259. // 日期范围
  260. dateRange: [],
  261. // 查询参数
  262. queryParams: {
  263. pageNum: 1,
  264. pageSize: 10,
  265. type: undefined
  266. },
  267. statusList: [
  268. {id: 1, name: '未发布', value: 0},
  269. {id: 2, name: '发布', value: 1},
  270. {id: 3, name: '下架', value: 2},
  271. ],
  272. visibleStatus: false,
  273. newObj: {},
  274. visibleType: ''
  275. };
  276. },
  277. computed: {
  278. ...mapGetters([
  279. 'name',
  280. ]),
  281. },
  282. created() {
  283. this.getList();
  284. },
  285. methods: {
  286. /** 查询列表 */
  287. getList() {
  288. this.loading = true;
  289. pageList(this.addDateRange(this.queryParams, this.dateRange))
  290. .then(response => {
  291. this.dataList = response.data.rows;
  292. this.dataList.forEach(item =>{
  293. item.switchValue = item.status;
  294. })
  295. this.total = response.data.total;
  296. this.loading = false;
  297. }
  298. );
  299. },
  300. // 取消按钮
  301. cancel() {
  302. this.open = false;
  303. },
  304. /** 搜索按钮操作 */
  305. handleQuery() {
  306. this.queryParams.pageNum = 1;
  307. this.getList();
  308. },
  309. /** 重置按钮操作 */
  310. resetQuery() {
  311. this.dateRange = [];
  312. this.$set(this.queryParams, 'name', '');
  313. this.$set(this.queryParams, 'type', '');
  314. this.$set(this.queryParams, 'salerPerson', '');
  315. this.$set(this.queryParams, 'createBy', '');
  316. this.queryParams.pageNum = 1;
  317. this.handleQuery();
  318. },
  319. /** 新增按钮操作 */
  320. handleAdd() {
  321. this.$refs["addAndEdit"].openDialog("新增数据", null);
  322. },
  323. /** 修改按钮操作 */
  324. handleUpdate(row) {
  325. this.$refs["addAndEdit"].openDialog("修改数据", row);
  326. },
  327. /** 详情 或 审核 */
  328. handleAudit(row,type) {
  329. this.$refs["auditBox"].openDialog("审核数据", row, type);
  330. },
  331. /** 启用或者禁用按钮操作 */
  332. updateStatusApi(row) {
  333. this.$confirm("是否对团队名称为" + row.name + "的数据进行" + (row.status == 1 ? '禁用?' : '启用?'), '提示', {
  334. confirmButtonText: '确定',
  335. cancelButtonText: '取消',
  336. type: 'warning'
  337. }).then(() => {
  338. updateStatus({ id: row.id, status: row.status == 1 ? 0 : 1 }).then((res) => {
  339. if (res.code == 200) {
  340. this.$message({
  341. type: 'success',
  342. message: '操作成功!'
  343. });
  344. this.getList();
  345. }
  346. });
  347. }).catch(() => {});
  348. },
  349. /** 重置密码按钮操作 */
  350. resettingApi(row) {
  351. this.$confirm("是否对团队名称为" + row.name + "的数据进行密码重置?重置后的密码为123456!", '提示', {
  352. confirmButtonText: '确定',
  353. cancelButtonText: '取消',
  354. type: 'warning'
  355. }).then(() => {
  356. updateStatus({ id: row.id, password: '123456' }).then((res) => {
  357. if (res.code == 200) {
  358. this.$message({
  359. type: 'success',
  360. message: '操作成功!'
  361. });
  362. this.getList();
  363. }
  364. });
  365. }).catch(() => {});
  366. },
  367. /** 删除按钮操作 */
  368. handleDelete(row) {
  369. this.$modal.confirm('是否确认删除数据团队名称为"' + row.name + '"的数据项?').then(function() {
  370. return deleteById(row.id);
  371. }).then(() => {
  372. this.getList();
  373. this.$modal.msgSuccess("删除成功");
  374. }).catch(() => {});
  375. },
  376. /** 查看按钮操作 */
  377. seeCenter(obj, type) {
  378. this.visibleStatus = true
  379. this.visibleType = type;
  380. this.newObj = obj;
  381. if(obj.contractImg){
  382. this.newObj.contractImgList = obj.contractImg.split(',')
  383. }
  384. },
  385. // 更多操作触发
  386. handleCommand(command, row,index) {
  387. switch (command) {
  388. case "handleResetPwd": // 重置密码
  389. this.resettingApi(row);
  390. break;
  391. case "rechargeBox":
  392. this.rechargeBoxFun(row);
  393. break;
  394. case "creditGranting":
  395. this.creditGrantingFun(row);
  396. break;
  397. case "creditGrantingBox":
  398. this.creditGrantingBoxFun(row);
  399. break;
  400. default:
  401. break;
  402. }
  403. },
  404. creditGrantingFun(row) {
  405. this.$refs["creditGranting"].openDialog("账户授信余额", row);
  406. },
  407. rechargeBoxFun(row) {
  408. this.$refs["rechargeBox"].openDialog("账户充值", row);
  409. },
  410. creditGrantingBoxFun(row) {
  411. this.$refs["creditGrantingBox"].openDialog("账户授信欠款", row);
  412. }
  413. }
  414. };
  415. </script>