index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. <template>
  2. <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title + '-列表', essential: true }]">
  3. <template slot-scope="{activeKey, data}">
  4. <div :style="{
  5. width: '100%',
  6. height: activeKey == 'list' ? '100%' : '0px',
  7. overflow: 'hidden'
  8. }">
  9. <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
  10. :operationColumnWidth="260" :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters"
  11. :column-parsing="columnParsing" :operation="operation()">
  12. <div slot="moreSearch">
  13. <el-radio-group v-model="examineStatus" size="mini" @change="changeType">
  14. <el-radio-button label="">全部</el-radio-button>
  15. <el-radio-button label="WAIT">待审核</el-radio-button>
  16. <el-radio-button label="OK">审核通过</el-radio-button>
  17. <el-radio-button label="FAIL">驳回</el-radio-button>
  18. </el-radio-group>
  19. <br><br>
  20. </div>
  21. <el-dialog title="绑定辅助师傅" width="500px" :modal="true" :visible.sync="formDialogaddsf" :show-close="true"
  22. :close-on-click-modal="false" :before-close="formCancelaa">
  23. <zj-form-container ref="formRefaa" :form-data="formDataaa" :styleSwitch="false" :formAttributes="{
  24. 'label-position': 'top'
  25. }">
  26. <zj-form-module title="绑定辅助师傅" label-width="100px" :showHade="false" :form-data="formDataaa"
  27. :form-items="formItemsaa">
  28. </zj-form-module>
  29. </zj-form-container>
  30. <div slot="footer">
  31. <el-button size="mini" @click="formCancelaa">取 消</el-button>
  32. <el-button size="mini" @click="queding">确 定</el-button>
  33. </div>
  34. </el-dialog>
  35. </template-page>
  36. </div>
  37. <div v-if="~['examine', 'detail'].indexOf(activeKey)" style="box-sizing: border-box;padding: 16px;">
  38. <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
  39. <zj-form-module :title="data.label" label-width="100px" :showPackUp="false" :form-data="formData"
  40. :form-items="[...formItems,...imageList]">
  41. </zj-form-module>
  42. </zj-form-container>
  43. <div slot="footer" class="dialog-footer">
  44. <el-button v-if="formData.examineStatus == 'WAIT'" size="mini" type="primary"
  45. @click="audit('OK', data.removeTab)">审核通过</el-button>
  46. <el-button v-if="formData.examineStatus == 'WAIT'" size="mini" type="danger"
  47. @click="audit('FAIL', data.removeTab)">审核驳回</el-button>
  48. <el-button size="mini" @click="data.removeTab()">取 消</el-button>
  49. </div>
  50. </div>
  51. </template>
  52. </zj-tab-page>
  53. </template>
  54. <script>
  55. import TemplatePage from '@/components/template/template-page-1.vue'
  56. import import_mixin from '@/components/template/import_mixin.js'
  57. import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
  58. import { memberSlaveBind, memberListPageV2, memberPageExport, getMemberDetail, memberAudit, memberInner } from "@/api/masterManagement";
  59. import operation_mixin from '@/components/template/operation_mixin.js'
  60. export default {
  61. components: { TemplatePage },
  62. mixins: [import_mixin, operation_mixin],
  63. data() {
  64. return {
  65. // 事件组合
  66. optionsEvensGroup: [],
  67. // 表格属性
  68. tableAttributes: {
  69. // 启用勾选列
  70. selectColumn: false
  71. },
  72. // 表格事件
  73. tableEvents: {
  74. 'selection-change': this.selectionChange
  75. },
  76. // 勾选选中行
  77. recordSelected: [],
  78. /** 表单变量 */
  79. formData: {
  80. type: '工程师',
  81. examineRemark: '',
  82. examineStatus: ''
  83. },
  84. examineStatus: '',
  85. formDialogaddsf: false,
  86. formDataaa: {
  87. slaveUserId: "",
  88. userId: "",
  89. websitId: ""
  90. },
  91. suoyoushifu: [],
  92. imageList: []
  93. }
  94. },
  95. computed: {
  96. // 更多参数
  97. moreParameters() {
  98. return []
  99. },
  100. formItems() {
  101. return [{
  102. md: 12,
  103. isShow: true,
  104. name: 'el-select',
  105. options: [{ label: '待审核', value: 'WAIT' }, { label: '驳回', value: 'FAIL' }, { label: '通过', value: 'OK' }],
  106. attributes: { placeholder: '请输入', disabled: true },
  107. formItemAttributes: {
  108. label: '审核状态',
  109. prop: 'examineStatus',
  110. rules: []
  111. },
  112. }, {
  113. md: 12,
  114. isShow: true,
  115. name: 'el-input',
  116. attributes: { disabled: true },
  117. formItemAttributes: {
  118. label: '用户类型',
  119. prop: 'type',
  120. rules: []
  121. }
  122. }, {
  123. md: 12,
  124. isShow: true,
  125. name: 'el-input',
  126. attributes: { placeholder: '请输入', disabled: true },
  127. formItemAttributes: {
  128. label: '用户名称',
  129. prop: 'nickName',
  130. rules: []
  131. }
  132. }, {
  133. md: 12,
  134. isShow: true,
  135. name: 'el-input',
  136. attributes: { placeholder: '请输入', disabled: true },
  137. formItemAttributes: {
  138. label: '联系电话',
  139. prop: 'mobile',
  140. rules: []
  141. }
  142. }, {
  143. md: 12,
  144. isShow: true,
  145. name: 'el-input',
  146. attributes: { placeholder: '请输入', disabled: true },
  147. formItemAttributes: {
  148. label: '身份证号码',
  149. prop: 'idCard',
  150. rules: []
  151. }
  152. }, {
  153. md: 12,
  154. isShow: true,
  155. name: 'slot-component',
  156. attributes: {},
  157. formItemAttributes: {
  158. label: '身份证',
  159. prop: 'idCardImg',
  160. rules: []
  161. },
  162. render: (h, { props, onInput }) => {
  163. var { value } = props
  164. console.log(this.formData.idCardImg)
  165. return (
  166. this.formData.idCardImg ? <el-image src={this.formData.idCardImg} style='width: 120px;height:120px' preview-src-list={[this.formData.idCardImg]} fit="cover"></el-image> : ''
  167. )
  168. }
  169. }, {
  170. md: 12,
  171. isShow: true,
  172. name: 'el-input',
  173. attributes: { placeholder: '请输入', disabled: true },
  174. formItemAttributes: {
  175. label: '所属商户',
  176. prop: 'companyName',
  177. rules: []
  178. }
  179. }, {
  180. md: 12,
  181. isShow: true,
  182. name: 'el-input',
  183. attributes: { placeholder: '请输入', disabled: true },
  184. formItemAttributes: {
  185. label: '入驻网点',
  186. prop: 'websitName',
  187. rules: []
  188. }
  189. }, {
  190. md: 24,
  191. isShow: true,
  192. name: 'el-input',
  193. attributes: { placeholder: '请输入', type: "textarea", disabled: this.formData.examineStatus == 'WAIT' ? false : true },
  194. formItemAttributes: {
  195. label: '备注',
  196. prop: 'examineRemark',
  197. rules: []
  198. }
  199. }]
  200. },
  201. formItemsaa() {
  202. return [{
  203. md: 24,
  204. isShow: true,
  205. name: 'el-select',
  206. options: this.suoyoushifu,
  207. attributes: { placeholder: '请输入' },
  208. formItemAttributes: {
  209. label: '选择师傅',
  210. prop: 'slaveUserId',
  211. rules: [...required]
  212. },
  213. events: {
  214. change: (val) => {
  215. if (val) {
  216. this.formDataaa.websitId = this.suoyoushifu.find(item => item.value == val)?.websitId
  217. } else {
  218. this.formDataaa.websitId = ""
  219. }
  220. }
  221. }
  222. },]
  223. }
  224. },
  225. methods: {
  226. queding() {
  227. this.$refs.formRefaa.validate((valid, invalidFields, errLabels) => {
  228. if (valid) {
  229. memberSlaveBind(this.formDataaa).then(res => {
  230. this.$message({
  231. type: 'success',
  232. message: '绑定成功成功'
  233. })
  234. this.formCancelaa()
  235. this.$refs.pageRef.refreshList()
  236. })
  237. }
  238. })
  239. },
  240. formCancelaa() {
  241. this.$refs?.formRefaa?.$refs?.inlineForm?.clearValidate()
  242. this.$data.formDataaa = this.$options.data().formDataaa
  243. this.formDialogaddsf = false
  244. },
  245. // 切换状态
  246. changeType(val) {
  247. this.$refs.pageRef.refreshList()
  248. },
  249. // 列表请求函数
  250. getList(p) {
  251. try {
  252. var pam = JSON.parse(JSON.stringify(p))
  253. if (this.examineStatus) {
  254. pam.params.push({ "param": "b.examine_status", "compare": "=", "value": this.examineStatus })
  255. }
  256. return memberListPageV2(pam)
  257. } catch (error) {
  258. console.log(error)
  259. }
  260. },
  261. // 列表导出函数
  262. exportList: memberPageExport,
  263. // 表格列解析渲染数据更改
  264. columnParsing(item, defaultData) {
  265. if (item.jname === 'idCardImg') {
  266. defaultData.render = (h, { row, index, column }) => {
  267. return (
  268. <div style="padding:0 6px;cursor: pointer;">
  269. {row.idCardImg ? row.idCardImg.split(",").map(url => <el-image src={url} preview-src-list={[url]} fit="fit" style="width:80px;height:80px;" />) : null}
  270. </div>
  271. )
  272. }
  273. }
  274. return defaultData
  275. },
  276. // 监听勾选变化
  277. selectionChange(data) {
  278. this.recordSelected = data
  279. },
  280. // 表格操作列
  281. operation() {
  282. return this.operationBtn({
  283. detail: {
  284. btnType: 'text',
  285. click: ({ row, index, column }) => {
  286. this.$refs.tabPage.addTab({
  287. activeKey: "detail",
  288. key: "detail",
  289. label: "详情",
  290. triggerEvent: () => {
  291. this.guanbi()
  292. this.imageList = []
  293. this.$nextTick(() => {
  294. getMemberDetail({ id: row.id }).then(res => {
  295. Object.assign(this.formData, res.data)
  296. res.data.workerImgList.forEach(item=>{
  297. this.imageList.push({
  298. md: 12,
  299. isShow: true,
  300. name: 'slot-component',
  301. attributes: {},
  302. formItemAttributes: {
  303. label: item.imgName,
  304. prop: 'imgName',
  305. rules: []
  306. },
  307. render: (h, { props, onInput }) => {
  308. var { value } = props
  309. return (
  310. item.imgUrl ? <el-image src={item.imgUrl} style='width: 120px;height:120px' preview-src-list={[item.imgUrl]} fit="cover"></el-image> : ''
  311. )
  312. }
  313. })
  314. })
  315. })
  316. })
  317. },
  318. closeEvent: () => {
  319. }
  320. })
  321. }
  322. },
  323. examine: {
  324. btnType: 'text',
  325. conditions: ({ row, index, column }) => {
  326. return row.examineStatus == 'WAIT'
  327. },
  328. click: ({ row, index, column }) => {
  329. this.$refs.tabPage.addTab({
  330. activeKey: "examine",
  331. key: "examine",
  332. label: "审核",
  333. triggerEvent: () => {
  334. this.guanbi()
  335. this.$nextTick(() => {
  336. getMemberDetail({ id: row.id }).then(res => {
  337. Object.assign(this.formData, res.data)
  338. })
  339. })
  340. },
  341. closeEvent: () => {
  342. }
  343. })
  344. }
  345. },
  346. setService: {
  347. btnType: 'text',
  348. prompt: '请确认是否设为分销员?',
  349. click: ({ row, index, column }) => {
  350. memberInner({
  351. type: 'SERVICE',
  352. userId: row.userId
  353. }).then(res => {
  354. if (res.code == 200) {
  355. this.$message({ type: 'success', message: '设为分销员成功!' })
  356. this.$refs.pageRef.refreshList()
  357. } else {
  358. this.$message.error(res.msg);
  359. }
  360. })
  361. }
  362. },
  363. setCustomer: {
  364. btnType: 'text',
  365. prompt: '请确认是否设为客户?',
  366. click: ({ row, index, column }) => {
  367. memberInner({
  368. type: 'GENERAL',
  369. userId: row.userId
  370. }).then(res => {
  371. if (res.code == 200) {
  372. this.$message({ type: 'success', message: '设为客户成功!' })
  373. this.$refs.pageRef.refreshList()
  374. } else {
  375. this.$message.error(res.msg);
  376. }
  377. })
  378. }
  379. },
  380. bindWorker: {
  381. btnType: 'text',
  382. conditions: ({ row, index, column }) => {
  383. return row.examineStatus == 'OK'
  384. },
  385. click: ({ row, index, column }) => {
  386. memberListPageV2({ "pageNum": 1, "pageSize": -1, "params": [{"param":"b.examine_status","compare":"=","value":"OK"}] }).then(res => {
  387. this.suoyoushifu = res.data.records.filter(item => item.id != row.id).map(item => ({
  388. label: item.nickName,
  389. value: item.userId,
  390. websitId: item.websitId
  391. }))
  392. this.formDataaa.userId = row.userId
  393. this.formDialogaddsf = true
  394. })
  395. }
  396. },
  397. })
  398. },
  399. guanbi() {
  400. this.$refs?.formRef?.$refs?.inlineForm?.clearValidate()
  401. this.$data.formData = this.$options.data().formData
  402. },
  403. audit(examineStatusEnum, removeTab) {
  404. memberAudit({
  405. examineStatusEnum,
  406. examineRemark: this.formData.examineRemark,
  407. id: this.formData.id
  408. }).then(res => {
  409. this.$message({ type: 'success', message: '审核成功!' })
  410. removeTab('list')
  411. this.$refs.pageRef.refreshList()
  412. })
  413. },
  414. }
  415. }
  416. </script>
  417. <style lang="scss" scoped>
  418. .tab {
  419. padding: 20px 20px 0 20px;
  420. }
  421. </style>