sales_line.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <div class="app-container">
  3. <!-- 筛选条件 -->
  4. <div class="screen-container">
  5. <div class="top clearfix">
  6. <div class="title fl">条件筛选</div>
  7. </div>
  8. <el-form ref="screenForm" :model="screenForm" label-width="70px" size="small" label-position="left">
  9. <el-row :gutter="20">
  10. <el-col :xs="24" :sm="12" :lg="6">
  11. <el-form-item label="业务线" prop="name">
  12. <el-input v-model="screenForm.name" placeholder="请输入业务线"></el-input>
  13. </el-form-item>
  14. </el-col>
  15. <el-col :xs="24" :sm="12" :lg="18" class="tr">
  16. <el-form-item label="">
  17. <el-button size="small" @click="resetScreenForm">清空</el-button>
  18. <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
  19. </el-form-item>
  20. </el-col>
  21. </el-row>
  22. </el-form>
  23. </div>
  24. <div class="mymain-container">
  25. <div class="btn-group clearfix">
  26. <div class="fl">
  27. <el-button size="small" type="primary" icon="el-icon-plus" @click="openMainForm('add')">新增</el-button>
  28. </div>
  29. <div class="fr">
  30. <el-button size="small" type="primary" icon="el-icon-download" @click="handleExport">导出数据</el-button>
  31. </div>
  32. </div>
  33. <div class="table">
  34. <el-table v-loading="listLoading" :data="dataList" element-loading-text="Loading" border fit highlight-current-row stripe>
  35. <el-table-column align="center" label="状态" prop="aaa" min-width="100">
  36. <template slot-scope="scope">
  37. <el-tag :type="scope.row.status ? 'success':'danger'">{{ scope.row.status ? '启用':'禁用' }}</el-tag>
  38. </template>
  39. </el-table-column>
  40. <el-table-column align="center" label="业务线" prop="aaa" min-width="100" show-overflow-tooltip></el-table-column>
  41. <el-table-column align="center" label="业务线名称" prop="aaa" min-width="100" show-overflow-tooltip></el-table-column>
  42. <el-table-column align="center" label="销售公司" prop="aaa" min-width="200" show-overflow-tooltip></el-table-column>
  43. <el-table-column align="center" label="创建人" prop="aaa" min-width="100" show-overflow-tooltip></el-table-column>
  44. <el-table-column align="center" label="创建时间" prop="aaa" min-width="160" show-overflow-tooltip></el-table-column>
  45. <el-table-column align="center" label="更新人" prop="aaa" min-width="100" show-overflow-tooltip></el-table-column>
  46. <el-table-column align="center" label="更新时间" prop="aaa" min-width="160" show-overflow-tooltip></el-table-column>
  47. <el-table-column align="center" label="操作" width="100">
  48. <template slot-scope="scope">
  49. <el-button type="text" @click="openMainForm('edit', scope.row.id)">编辑</el-button>
  50. <el-popconfirm v-if="scope.row.status" style="margin-left: 10px;" title="确定删除吗?" @onConfirm="handleDelete(scope.row.id, 0)" >
  51. <el-button slot="reference" type="text">删除</el-button>
  52. </el-popconfirm>
  53. </template>
  54. </el-table-column>
  55. </el-table>
  56. </div>
  57. </div>
  58. <div class="pagination clearfix">
  59. <div class="fr">
  60. <el-pagination
  61. @size-change="handleSizeChange"
  62. @current-change="handleCurrentChange"
  63. :current-page="currentPage"
  64. :page-sizes="[10, 20, 30, 50]"
  65. :page-size="10"
  66. layout="total, sizes, prev, pager, next, jumper"
  67. :total="listTotal">
  68. </el-pagination>
  69. </div>
  70. </div>
  71. <!-- 新增编辑 -->
  72. <el-dialog :title="mainFormType == 'add' ? '新增':'编辑'" :visible.sync="mainFormVisible" :show-close="false" width="40%" :close-on-click-modal="false">
  73. <el-form ref="mainForm" :model="mainForm" :rules="mainFormRules" label-position="left" label-width="100px">
  74. <el-form-item label="业务线名称" prop="name">
  75. <el-input placeholder="请输入业务线名称" v-model="mainForm.name"></el-input>
  76. </el-form-item>
  77. <el-form-item label="业务线" prop="line">
  78. <el-select v-model="mainForm.line" placeholder="请选择业务线" style="width: 100%;">
  79. <el-option :label="item.name" :value="item.id" v-for="(item, index) in departmentList" :key="index"></el-option>
  80. </el-select>
  81. </el-form-item>
  82. <el-form-item label="状态" prop="status">
  83. <el-radio-group v-model="mainForm.status">
  84. <el-radio :label="true">启用</el-radio>
  85. <el-radio :label="false">禁用</el-radio>
  86. </el-radio-group>
  87. </el-form-item>
  88. </el-form>
  89. <div slot="footer" class="dialog-footer">
  90. <el-button @click="cancelMainForm">取 消</el-button>
  91. <el-button type="primary" @click="submitMainForm">确 定</el-button>
  92. </div>
  93. </el-dialog>
  94. </div>
  95. </template>
  96. <script>
  97. import { getRelationList } from "@/api/sales_region";
  98. import { downloadFiles } from '@/utils/util'
  99. export default {
  100. data() {
  101. return {
  102. currentPage: 1, // 当前页码
  103. pageSize: 10, // 每页数量
  104. listTotal: 0, // 列表总数
  105. dataList: null, // 列表数据
  106. listLoading: false, // 列表加载loading
  107. screenForm: { // 筛选表单数据
  108. name: '',
  109. },
  110. mainFormVisible: false,
  111. mainFormType: 'add',
  112. mainForm: {
  113. name: '',
  114. line: '',
  115. status: true,
  116. },
  117. mainFormRules: {
  118. name: [
  119. { required: true, message: '请输入业务线名称', trigger: 'blur' }
  120. ],
  121. line: [
  122. { required: true, message: '请选择业务线', trigger: 'change' }
  123. ],
  124. },
  125. salesManList: [],
  126. departmentList: [],
  127. }
  128. },
  129. created() {
  130. this.getList();
  131. },
  132. methods: {
  133. // 查询按钮权限
  134. checkBtnRole(value) {
  135. // let btnRole = this.$route.meta.roles;
  136. // if(!btnRole) {return true}
  137. // let index = btnRole.indexOf(value);
  138. // return index >= 0;
  139. return true
  140. },
  141. // 查询列表
  142. getList() {
  143. this.listLoading = true;
  144. let params = {
  145. pageNum: this.currentPage,
  146. pageSize: this.pageSize,
  147. userName: this.screenForm.account,
  148. nickName: this.screenForm.nickName,
  149. linkPhone: this.screenForm.phone,
  150. email: this.screenForm.email,
  151. status: this.screenForm.status,
  152. };
  153. getRelationList(params).then((res) => {
  154. this.dataList = res.data.records;
  155. this.listTotal = res.data.total;
  156. this.listLoading = false;
  157. })
  158. },
  159. // 提交筛选表单
  160. submitScreenForm() {
  161. this.currentPage = 1;
  162. this.getList();
  163. },
  164. // 重置筛选表单
  165. resetScreenForm() {
  166. this.$refs.screenForm.resetFields();
  167. this.currentPage = 1;
  168. this.getList();
  169. },
  170. // 更改每页数量
  171. handleSizeChange(val) {
  172. this.pageSize = val;
  173. this.currentPage = 1;
  174. this.getList();
  175. },
  176. // 更改当前页
  177. handleCurrentChange(val) {
  178. this.currentPage = val;
  179. this.getList();
  180. },
  181. // 打开 新增编辑
  182. openMainForm(type, id) {
  183. this.mainFormType = type;
  184. this.mainFormVisible = true;
  185. },
  186. // 取消 新增编辑 账号表单
  187. cancelMainForm(){
  188. this.mainFormVisible = false;
  189. this.$refs.mainForm.resetFields();
  190. },
  191. // 提交
  192. submitMainForm() {
  193. this.$refs.mainForm.validate((valid) => {
  194. if (valid) {
  195. let params = {
  196. password: this.mainForm.salesMan,
  197. password: this.mainForm.salesLine,
  198. }
  199. resetPassword(params).then(res => {
  200. this.getList();
  201. this.cancelMainForm();
  202. this.$successMsg();
  203. })
  204. }
  205. })
  206. },
  207. // 导出
  208. handleExport() {
  209. let screenData = {
  210. userName: this.screenForm.account,
  211. nickName: this.screenForm.nickName,
  212. linkPhone: this.screenForm.phone,
  213. email: this.screenForm.email,
  214. status: this.screenForm.status,
  215. };
  216. downloadFiles('admin/user/mch/export', screenData);
  217. },
  218. }
  219. }
  220. </script>
  221. <style lang="scss" scoped>
  222. </style>