sales_line.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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
  35. v-loading="listLoading"
  36. :data="dataList"
  37. element-loading-text="Loading"
  38. border
  39. fit
  40. highlight-current-row
  41. stripe
  42. >
  43. <el-table-column align="center" label="状态" prop="aaa" min-width="100">
  44. <template slot-scope="scope">
  45. <el-tag :type="scope.row.status ? 'success' : 'danger'">{{ scope.row.status ? '启用' : '禁用' }}</el-tag>
  46. </template>
  47. </el-table-column>
  48. <el-table-column
  49. align="center"
  50. label="业务线"
  51. prop="aaa"
  52. min-width="100"
  53. show-overflow-tooltip
  54. ></el-table-column>
  55. <el-table-column
  56. align="center"
  57. label="业务线名称"
  58. prop="aaa"
  59. min-width="100"
  60. show-overflow-tooltip
  61. ></el-table-column>
  62. <el-table-column
  63. align="center"
  64. label="销售公司"
  65. prop="aaa"
  66. min-width="200"
  67. show-overflow-tooltip
  68. ></el-table-column>
  69. <el-table-column
  70. align="center"
  71. label="创建人"
  72. prop="aaa"
  73. min-width="100"
  74. show-overflow-tooltip
  75. ></el-table-column>
  76. <el-table-column
  77. align="center"
  78. label="创建时间"
  79. prop="aaa"
  80. min-width="160"
  81. show-overflow-tooltip
  82. ></el-table-column>
  83. <el-table-column
  84. align="center"
  85. label="更新人"
  86. prop="aaa"
  87. min-width="100"
  88. show-overflow-tooltip
  89. ></el-table-column>
  90. <el-table-column
  91. align="center"
  92. label="更新时间"
  93. prop="aaa"
  94. min-width="160"
  95. show-overflow-tooltip
  96. ></el-table-column>
  97. <el-table-column align="center" label="操作" width="100">
  98. <template slot-scope="scope">
  99. <el-button type="text" @click="openMainForm('edit', scope.row.id)">编辑</el-button>
  100. <el-popconfirm
  101. v-if="scope.row.status"
  102. style="margin-left: 10px"
  103. title="确定删除吗?"
  104. @onConfirm="handleDelete(scope.row.id, 0)"
  105. >
  106. <el-button slot="reference" type="text">删除</el-button>
  107. </el-popconfirm>
  108. </template>
  109. </el-table-column>
  110. </el-table>
  111. </div>
  112. </div>
  113. <div class="pagination clearfix">
  114. <div class="fr">
  115. <el-pagination
  116. @size-change="handleSizeChange"
  117. @current-change="handleCurrentChange"
  118. :current-page="currentPage"
  119. :page-sizes="[10, 20, 30, 50]"
  120. :page-size="10"
  121. layout="total, sizes, prev, pager, next, jumper"
  122. :total="listTotal"
  123. >
  124. </el-pagination>
  125. </div>
  126. </div>
  127. <!-- 新增编辑 -->
  128. <el-dialog
  129. :title="mainFormType == 'add' ? '新增' : '编辑'"
  130. :visible.sync="mainFormVisible"
  131. :show-close="false"
  132. width="40%"
  133. :close-on-click-modal="false"
  134. >
  135. <el-form ref="mainForm" :model="mainForm" :rules="mainFormRules" label-position="left" label-width="100px">
  136. <el-form-item label="业务线名称" prop="name">
  137. <el-input placeholder="请输入业务线名称" v-model="mainForm.name"></el-input>
  138. </el-form-item>
  139. <el-form-item label="业务线" prop="line">
  140. <el-select v-model="mainForm.line" placeholder="请选择业务线" style="width: 100%">
  141. <el-option
  142. :label="item.name"
  143. :value="item.id"
  144. v-for="(item, index) in departmentList"
  145. :key="index"
  146. ></el-option>
  147. </el-select>
  148. </el-form-item>
  149. <el-form-item label="状态" prop="status">
  150. <el-radio-group v-model="mainForm.status">
  151. <el-radio :label="true">启用</el-radio>
  152. <el-radio :label="false">禁用</el-radio>
  153. </el-radio-group>
  154. </el-form-item>
  155. </el-form>
  156. <div slot="footer" class="dialog-footer">
  157. <el-button @click="cancelMainForm">取 消</el-button>
  158. <el-button type="primary" @click="submitMainForm">确 定</el-button>
  159. </div>
  160. </el-dialog>
  161. </div>
  162. </template>
  163. <script>
  164. import { getRelationList } from '@/api/sales_region'
  165. import { downloadFiles } from '@/utils/util'
  166. export default {
  167. data() {
  168. return {
  169. currentPage: 1, // 当前页码
  170. pageSize: 10, // 每页数量
  171. listTotal: 0, // 列表总数
  172. dataList: null, // 列表数据
  173. listLoading: false, // 列表加载loading
  174. screenForm: {
  175. // 筛选表单数据
  176. name: ''
  177. },
  178. mainFormVisible: false,
  179. mainFormType: 'add',
  180. mainForm: {
  181. name: '',
  182. line: '',
  183. status: true
  184. },
  185. mainFormRules: {
  186. name: [{ required: true, message: '请输入业务线名称', trigger: 'blur' }],
  187. line: [{ required: true, message: '请选择业务线', trigger: 'change' }]
  188. },
  189. salesManList: [],
  190. departmentList: []
  191. }
  192. },
  193. created() {
  194. this.getList()
  195. },
  196. methods: {
  197. // 查询按钮权限
  198. checkBtnRole(value) {
  199. // let btnRole = this.$route.meta.roles;
  200. // if(!btnRole) {return true}
  201. // let index = btnRole.indexOf(value);
  202. // return index >= 0;
  203. return true
  204. },
  205. // 查询列表
  206. getList() {
  207. this.listLoading = true
  208. let params = {
  209. pageNum: this.currentPage,
  210. pageSize: this.pageSize,
  211. userName: this.screenForm.account,
  212. nickName: this.screenForm.nickName,
  213. linkPhone: this.screenForm.phone,
  214. email: this.screenForm.email,
  215. status: this.screenForm.status
  216. }
  217. getRelationList(params).then(res => {
  218. this.dataList = res.data.records
  219. this.listTotal = res.data.total
  220. this.listLoading = false
  221. })
  222. },
  223. // 提交筛选表单
  224. submitScreenForm() {
  225. this.currentPage = 1
  226. this.getList()
  227. },
  228. // 重置筛选表单
  229. resetScreenForm() {
  230. this.$refs.screenForm.resetFields()
  231. this.currentPage = 1
  232. this.getList()
  233. },
  234. // 更改每页数量
  235. handleSizeChange(val) {
  236. this.pageSize = val
  237. this.currentPage = 1
  238. this.getList()
  239. },
  240. // 更改当前页
  241. handleCurrentChange(val) {
  242. this.currentPage = val
  243. this.getList()
  244. },
  245. // 打开 新增编辑
  246. openMainForm(type, id) {
  247. this.mainFormType = type
  248. this.mainFormVisible = true
  249. },
  250. // 取消 新增编辑 账号表单
  251. cancelMainForm() {
  252. this.mainFormVisible = false
  253. this.$refs.mainForm.resetFields()
  254. },
  255. // 提交
  256. submitMainForm() {
  257. this.$refs.mainForm.validate(valid => {
  258. if (valid) {
  259. let params = {
  260. password: this.mainForm.salesMan,
  261. password: this.mainForm.salesLine
  262. }
  263. resetPassword(params).then(res => {
  264. this.getList()
  265. this.cancelMainForm()
  266. this.$successMsg()
  267. })
  268. }
  269. })
  270. },
  271. // 导出
  272. handleExport() {
  273. let screenData = {
  274. userName: this.screenForm.account,
  275. nickName: this.screenForm.nickName,
  276. linkPhone: this.screenForm.phone,
  277. email: this.screenForm.email,
  278. status: this.screenForm.status
  279. }
  280. downloadFiles('admin/user/mch/export', screenData)
  281. }
  282. }
  283. }
  284. </script>
  285. <style lang="scss" scoped></style>