index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents" :operationColumnWidth="200"
  3. :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
  4. :operation="operation">
  5. <!-- :exportList="exportList" -->
  6. <el-dialog title="" width="500px" custom-class="diy-dialog" append-to-body :modal="true" :visible.sync="formDialog"
  7. :show-close="true" :close-on-click-modal="false" :modal-append-to-body="false" :before-close="formCancel">
  8. <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
  9. <zj-form-module :title="formDialogTitles[formDialogType]" label-width="100px" :showPackUp="false"
  10. :form-data="formData" :form-items="formItems">
  11. </zj-form-module>
  12. </zj-form-container>
  13. <div slot="footer" class="dialog-footer">
  14. <el-button size="mini" @click="formCancel">取 消</el-button>
  15. <el-button size="mini" @click="formConfirm" type="primary">确 定</el-button>
  16. </div>
  17. </el-dialog>
  18. <!-- 入驻网点 -->
  19. <el-dialog title="设为工程师" :visible.sync="dialogVisible" @close="websitList = []" width="40%" :close-on-click-modal="false" :modal-append-to-body="false">
  20. <el-form ref="workerForm" :model="workerForm" label-width="110px" size="small" label-position="left">
  21. <el-row :gutter="20">
  22. <el-col :span="24">
  23. <el-form-item label="入驻网点" :required="true">
  24. <el-select v-model="workerForm.websitId" placeholder="请选择" style="width: 100%;">
  25. <el-option
  26. v-for="item in websitList"
  27. :key="item.websitId"
  28. :label="item.name"
  29. :value="item.websitId">
  30. </el-option>
  31. </el-select>
  32. </el-form-item>
  33. </el-col>
  34. </el-row>
  35. </el-form>
  36. <div slot="footer" class="dialog-footer">
  37. <el-button @click="dialogVisible = false">取 消</el-button>
  38. <el-button type="primary" @click="memberInner()">确定</el-button>
  39. </div>
  40. </el-dialog>
  41. </template-page>
  42. </template>
  43. <script>
  44. import TemplatePage from '@/components/template/template-page-1.vue'
  45. import import_mixin from '@/components/template/import_mixin.js'
  46. import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
  47. import { memberListPageV2,memberPageExport, memberAudit, memberInner, getWebsit } from "@/api/customerManagement";
  48. export default {
  49. components: { TemplatePage },
  50. mixins: [import_mixin],
  51. data() {
  52. return {
  53. // 事件组合
  54. optionsEvensGroup: [],
  55. // 表格属性
  56. tableAttributes: {
  57. // 启用勾选列
  58. selectColumn: false
  59. },
  60. // 表格事件
  61. tableEvents: {
  62. 'selection-change': this.selectionChange
  63. },
  64. // 勾选选中行
  65. recordSelected: [],
  66. /** 表单变量 */
  67. formDialogType: 0,
  68. formDialogTitles: [],
  69. formDialog: false,
  70. dialogVisible: false,
  71. formData: {
  72. storageName: '',
  73. storageMobile: '',
  74. storageAddress: '',
  75. },
  76. websitList: [],
  77. workerForm: {
  78. websitId: '',
  79. userId: '',
  80. }
  81. }
  82. },
  83. computed: {
  84. // 更多参数
  85. moreParameters() {
  86. return []
  87. },
  88. formItems() {
  89. }
  90. },
  91. methods: {
  92. // 列表请求函数
  93. getList: memberListPageV2,
  94. // 列表导出函数
  95. exportList: memberPageExport,
  96. // 表格列解析渲染数据更改
  97. columnParsing(item, defaultData) {
  98. return defaultData
  99. },
  100. // 监听勾选变化
  101. selectionChange(data) {
  102. this.recordSelected = data
  103. },
  104. // 表格操作列
  105. operation(h, { row, index, column }) {
  106. return (
  107. <div class='operation-btns'>
  108. <el-button type="text" onClick={() => {
  109. }}>详情</el-button>
  110. {row.examineStatus != 'WAIT' ?<el-button type="text" onClick={() => {
  111. this.workerForm.userId = row.userId
  112. getWebsit().then(res => {
  113. this.websitList = res.data
  114. this.dialogVisible = true
  115. })
  116. }}>设为工程师</el-button>:null}
  117. {row.examineStatus != 'WAIT' ?<el-button type="text" onClick={() => {
  118. this.$confirm('请确认是否设为分销员, 是否继续?', '提示', {
  119. confirmButtonText: '确定',
  120. cancelButtonText: '取消',
  121. type: 'warning'
  122. }).then(() => {
  123. memberInner({
  124. type: 'SERVICE',
  125. userIds: row.userId
  126. }).then(res => {
  127. if (res.code == 200) {
  128. this.$message({ type: 'success', message: '设为分销员成功!' })
  129. this.$refs.pageRef.refreshList()
  130. } else {
  131. this.$message.error(res.msg);
  132. }
  133. })
  134. });
  135. }}>设为分销员</el-button>:null}
  136. </div>
  137. )
  138. },
  139. addData() {
  140. this.formDialogType = 0
  141. this.openForm()
  142. },
  143. openForm() {
  144. this.formDialog = true;
  145. },
  146. formCancel() {
  147. this.$refs.formRef.$refs.inlineForm.clearValidate()
  148. this.$data.formData = this.$options.data().formData
  149. this.formDialog = false
  150. },
  151. memberInner(){
  152. if(!this.workerForm.websitId){
  153. return this.$message({ type: 'danger', message: '请选择入驻网点!' })
  154. }
  155. memberInner({
  156. type: 'WORKER',
  157. userIds: this.workerForm.userId,
  158. websitId: this.workerForm.websitId
  159. }).then(res => {
  160. this.dialogVisible = false
  161. this.$message({ type: 'success', message: '设置工程师成功!' })
  162. this.$refs.pageRef.refreshList()
  163. })
  164. },
  165. formConfirm() {
  166. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  167. if (valid) {
  168. ([addMember, editMember][this.formDialogType])(this.formData).then(res => {
  169. this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
  170. this.formCancel()
  171. this.$refs.pageRef.refreshList()
  172. })
  173. }
  174. })
  175. }
  176. }
  177. }
  178. </script>
  179. <style lang="scss" scoped></style>