index.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="公司名" prop="companyId">
  5. <el-select filterable style="width: 220px" v-model="queryParams.companyId" placeholder="请选择公司名" clearable size="small">
  6. <el-option
  7. v-for="item in companys"
  8. :key="item.companyId"
  9. :label="item.companyName"
  10. :value="item.companyId"
  11. />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="企微账号" prop="userName">
  15. <el-input
  16. v-model="queryParams.userName"
  17. placeholder="请输入企微账号"
  18. clearable
  19. size="small"
  20. @keyup.enter.native="handleQuery"
  21. />
  22. </el-form-item>
  23. <el-form-item label="手机号码" prop="phone">
  24. <el-input
  25. v-model="queryParams.phone"
  26. placeholder="请输入手机号码"
  27. clearable
  28. size="small"
  29. @keyup.enter.native="handleQuery"
  30. />
  31. </el-form-item>
  32. <el-form-item>
  33. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  34. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  35. </el-form-item>
  36. </el-form>
  37. <el-row :gutter="10" class="mb8">
  38. <el-col :span="1.5">
  39. <el-button
  40. type="danger"
  41. icon="el-icon-delete"
  42. size="mini"
  43. :disabled="multiple"
  44. @click="handleDelete"
  45. v-hasPermi="['qw:account:remove']"
  46. >删除</el-button>
  47. </el-col>
  48. </el-row>
  49. <el-tabs type="card" v-model="queryParams.isAudit" @tab-click="handleClick">
  50. <el-tab-pane label="待审核" name="0"></el-tab-pane>
  51. <el-tab-pane label="已通过" name="1"></el-tab-pane>
  52. <el-tab-pane label="已驳回" name="-1"></el-tab-pane>
  53. </el-tabs>
  54. <el-table v-loading="loading" :data="accountList" @selection-change="handleSelectionChange">
  55. <el-table-column type="selection" width="55" align="center" />
  56. <el-table-column label="序号" width="55" type="index" align="center" />
  57. <el-table-column label="id" align="center" prop="id" />
  58. <el-table-column label="企微账号" align="center" prop="userName" />
  59. <el-table-column label="姓名" align="center" prop="nickName" />
  60. <el-table-column label="手机号码" align="center" prop="phone" />
  61. <el-table-column label="归属公司" align="center" prop="companyName" />
  62. <el-table-column label="归属员工" align="center" prop="companyUserName" />
  63. <el-table-column width="500" label="关联设备id" align="center" prop="deviceId" v-if="queryParams.isAudit == 1"/>
  64. <el-table-column label="备注" align="center" prop="remark" />
  65. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  66. <template slot-scope="scope">
  67. <el-button
  68. v-if="scope.row.isAudit==0"
  69. size="mini"
  70. type="text"
  71. icon="el-icon-edit"
  72. @click="handleAudit(scope.row)"
  73. v-hasPermi="['qw:account:audit']"
  74. >审核</el-button>
  75. <el-button
  76. size="mini"
  77. type="text"
  78. icon="el-icon-delete"
  79. @click="handleDelete(scope.row)"
  80. v-hasPermi="['qw:account:remove']"
  81. >删除</el-button>
  82. </template>
  83. </el-table-column>
  84. </el-table>
  85. <pagination
  86. v-show="total>0"
  87. :total="total"
  88. :page.sync="queryParams.pageNum"
  89. :limit.sync="queryParams.pageSize"
  90. @pagination="getList"
  91. />
  92. <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
  93. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  94. <el-form-item label="公司" prop="companyName">
  95. <el-input v-model="form.companyName" disabled />
  96. </el-form-item>
  97. <el-form-item label="归属员工" prop="companyUserName">
  98. <el-input v-model="form.companyUserName" disabled />
  99. </el-form-item>
  100. <el-form-item label="状态">
  101. <el-radio-group v-model="form.isAudit">
  102. <el-radio label="1">通过</el-radio>
  103. <el-radio label="-1">驳回</el-radio>
  104. </el-radio-group>
  105. </el-form-item>
  106. <el-form-item label="备注" prop="remark">
  107. <el-input v-model="form.remark" type="textarea" :row="5" />
  108. </el-form-item>
  109. </el-form>
  110. <div slot="footer" class="dialog-footer">
  111. <el-button type="primary" @click="submitForm">确 定</el-button>
  112. <el-button @click="cancel">取 消</el-button>
  113. </div>
  114. </el-dialog>
  115. </div>
  116. </template>
  117. <script>
  118. import { listAccount, getAccount, delAccount, addAccount, auditAccount, exportAccount } from "@/api/qw/account";
  119. import { getCompanyList } from "@/api/company/company";
  120. export default {
  121. name: "Account",
  122. data() {
  123. return {
  124. // 遮罩层
  125. loading: true,
  126. // 选中数组
  127. ids: [],
  128. companys:[],
  129. // 非单个禁用
  130. single: true,
  131. // 非多个禁用
  132. multiple: true,
  133. // 显示搜索条件
  134. showSearch: true,
  135. // 总条数
  136. total: 0,
  137. activeName:"1",
  138. // 企微功能账号管理表格数据
  139. accountList: [],
  140. isAuditOptions:[],
  141. // 弹出层标题
  142. title: "",
  143. // 是否显示弹出层
  144. open: false,
  145. // 查询参数
  146. queryParams: {
  147. pageNum: 1,
  148. pageSize: 10,
  149. userName: null,
  150. passWord: null,
  151. phone: null,
  152. email: null,
  153. status: null,
  154. realName: null,
  155. nickName: null,
  156. companyId: null,
  157. deviceId: null,
  158. deptId: null,
  159. companyUserId: null,
  160. isAudit: 0,
  161. },
  162. // 表单参数
  163. form: {},
  164. auditForm:{
  165. id:null,
  166. isAudit: null,
  167. deviceId: null,
  168. },
  169. // 表单校验
  170. rules: {
  171. deviceId: [
  172. { required: true, message: "关联设备id不能为空", trigger: "blur" }
  173. ],
  174. isAudit: [
  175. { required: true, message: "是否审核不能为空", trigger: "blur" }
  176. ],
  177. }
  178. };
  179. },
  180. created() {
  181. this.getList();
  182. getCompanyList().then(response => {
  183. this.companys = response.data;
  184. });
  185. this.getDicts("common_audit").then((response) => {
  186. this.isAuditOptions = response.data;
  187. });
  188. },
  189. methods: {
  190. /** 查询企微功能账号管理列表 */
  191. getList() {
  192. this.loading = true;
  193. listAccount(this.queryParams).then(response => {
  194. this.accountList = response.rows;
  195. this.total = response.total;
  196. this.loading = false;
  197. });
  198. },
  199. // 取消按钮
  200. cancel() {
  201. this.open = false;
  202. this.reset();
  203. },
  204. // 表单重置
  205. reset() {
  206. this.form = {
  207. id: null,
  208. userName: null,
  209. passWord: null,
  210. phone: null,
  211. email: null,
  212. createTime: null,
  213. remark: null,
  214. realName: null,
  215. nickName: null,
  216. companyId: null,
  217. deviceId: null,
  218. deptId: null,
  219. companyUserId: null,
  220. isAudit: null,
  221. updateTime: null
  222. };
  223. this.resetForm("form");
  224. },
  225. handleClick(tab, event) {
  226. this.queryParams.isAudit=tab.name;
  227. this.getList();
  228. },
  229. /** 搜索按钮操作 */
  230. handleQuery() {
  231. this.queryParams.pageNum = 1;
  232. this.getList();
  233. },
  234. /** 重置按钮操作 */
  235. resetQuery() {
  236. this.resetForm("queryForm");
  237. this.handleQuery();
  238. },
  239. // 多选框选中数据
  240. handleSelectionChange(selection) {
  241. this.ids = selection.map(item => item.id)
  242. this.single = selection.length!==1
  243. this.multiple = !selection.length
  244. },
  245. /** 新增按钮操作 */
  246. handleAdd() {
  247. this.reset();
  248. this.open = true;
  249. this.title = "添加企微功能账号管理";
  250. },
  251. handleAudit(row) {
  252. this.reset();
  253. const id = row.id || this.ids
  254. getAccount(id).then(response => {
  255. this.form = response.data;
  256. this.form.companyName = row.companyName;
  257. this.form.companyUserName = row.companyUserName;
  258. this.form.isAudit="1"
  259. this.open = true;
  260. this.title = "账号审核";
  261. });
  262. },
  263. /** 提交按钮 */
  264. submitForm() {
  265. this.$refs["form"].validate(valid => {
  266. if (valid) {
  267. auditAccount(this.form).then(response => {
  268. if (response.code === 200) {
  269. this.msgSuccess("审核成功");
  270. this.open = false;
  271. this.getList();
  272. }
  273. });
  274. }
  275. });
  276. },
  277. /** 删除按钮操作 */
  278. handleDelete(row) {
  279. const ids = row.id || this.ids;
  280. this.$confirm('是否确认删除企微功能账号管理编号为"' + ids + '"的数据项?', "警告", {
  281. confirmButtonText: "确定",
  282. cancelButtonText: "取消",
  283. type: "warning"
  284. }).then(function() {
  285. return delAccount(ids);
  286. }).then(() => {
  287. this.getList();
  288. this.msgSuccess("删除成功");
  289. }).catch(function() {});
  290. },
  291. /** 导出按钮操作 */
  292. handleExport() {
  293. const queryParams = this.queryParams;
  294. this.$confirm('是否确认导出所有企微功能账号管理数据项?', "警告", {
  295. confirmButtonText: "确定",
  296. cancelButtonText: "取消",
  297. type: "warning"
  298. }).then(function() {
  299. return exportAccount(queryParams);
  300. }).then(response => {
  301. this.download(response.msg);
  302. }).catch(function() {});
  303. }
  304. }
  305. };
  306. </script>