|
@@ -1,9 +1,16 @@
|
|
|
<template>
|
|
|
- <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents" :operationColumnWidth="50"
|
|
|
- :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters" :column-parsing="columnParsing"
|
|
|
- :operation="operation()">
|
|
|
- <!-- :exportList="exportList" -->
|
|
|
- </template-page>
|
|
|
+ <template-page
|
|
|
+ ref="pageRef"
|
|
|
+ :get-list="getList"
|
|
|
+ :table-attributes="tableAttributes"
|
|
|
+ :table-events="tableEvents"
|
|
|
+ :operationColumnWidth="50"
|
|
|
+ :options-evens-group="optionsEvensGroup"
|
|
|
+ :moreParameters="moreParameters"
|
|
|
+ :column-parsing="columnParsing"
|
|
|
+ :operation="operation()"
|
|
|
+ >
|
|
|
+ </template-page>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
@@ -12,12 +19,12 @@ import import_mixin from '@/components/template/import_mixin.js'
|
|
|
import ImageUpload from '@/components/file-upload'
|
|
|
import { downloadFiles } from '@/utils/util'
|
|
|
import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
|
|
|
-import { listPageV2,pageExport, del, listImport } from "@/api/workerProfileInit";
|
|
|
+import { listPageV2, pageExport, del, listImport } from '@/api/workerProfileInit'
|
|
|
import { commonTemplateDownload } from '@/api/common.js'
|
|
|
import operation_mixin from '@/components/template/operation_mixin.js'
|
|
|
export default {
|
|
|
components: { TemplatePage, ImageUpload },
|
|
|
- mixins: [import_mixin,operation_mixin],
|
|
|
+ mixins: [import_mixin, operation_mixin],
|
|
|
data() {
|
|
|
return {
|
|
|
// 表格属性
|
|
@@ -33,33 +40,33 @@ export default {
|
|
|
recordSelected: [],
|
|
|
/** 表单变量 */
|
|
|
formDialogType: 0,
|
|
|
- formDialogTitles: ["新增","编辑", "详情"],
|
|
|
+ formDialogTitles: ['新增', '编辑', '详情'],
|
|
|
formDialog: false,
|
|
|
- formData: {},
|
|
|
+ formData: {}
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- // 事件组合
|
|
|
- optionsEvensGroup() {
|
|
|
- return [
|
|
|
- [
|
|
|
- [
|
|
|
- this.optionsEvensAuth("download", {
|
|
|
- click: () => {
|
|
|
- this.handleDownload()
|
|
|
- }
|
|
|
- })
|
|
|
- ],
|
|
|
- [
|
|
|
- this.optionsEvensAuth("import", {
|
|
|
- render: () => {
|
|
|
- return this.importButton(listImport, '导入师傅资料')
|
|
|
- }
|
|
|
- })
|
|
|
- ]
|
|
|
- ]
|
|
|
- ]
|
|
|
- },
|
|
|
+ // 事件组合
|
|
|
+ optionsEvensGroup() {
|
|
|
+ return [
|
|
|
+ [
|
|
|
+ [
|
|
|
+ this.optionsEvensAuth('download', {
|
|
|
+ click: () => {
|
|
|
+ this.handleDownload()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ this.optionsEvensAuth('import', {
|
|
|
+ render: () => {
|
|
|
+ return this.importButton(listImport, '导入师傅资料')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ ]
|
|
|
+ ]
|
|
|
+ ]
|
|
|
+ },
|
|
|
// 更多参数
|
|
|
moreParameters() {
|
|
|
return []
|
|
@@ -68,56 +75,52 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
// 列表请求函数
|
|
|
- getList(p,cb) {
|
|
|
- try {
|
|
|
- var pam = JSON.parse(JSON.stringify(p))
|
|
|
- // if (this.examineStatus) {
|
|
|
- // pam.params.push({ "param": "b.examine_status", "compare": "=", "value": this.examineStatus })
|
|
|
- // }
|
|
|
- cb && cb(pam)
|
|
|
- return listPageV2(pam)
|
|
|
- } catch (error) {
|
|
|
- console.log(error)
|
|
|
- }
|
|
|
- },
|
|
|
+ getList(p, cb) {
|
|
|
+ try {
|
|
|
+ var pam = JSON.parse(JSON.stringify(p))
|
|
|
+ cb && cb(pam)
|
|
|
+ return listPageV2(pam)
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error)
|
|
|
+ }
|
|
|
+ },
|
|
|
// 列表导出函数
|
|
|
exportList: pageExport,
|
|
|
// 表格列解析渲染数据更改
|
|
|
columnParsing(item, defaultData) {
|
|
|
-
|
|
|
return defaultData
|
|
|
},
|
|
|
// 监听勾选变化
|
|
|
selectionChange(data) {
|
|
|
this.recordSelected = data
|
|
|
},
|
|
|
- // 表格操作列
|
|
|
- operation() {
|
|
|
- return this.operationBtn({
|
|
|
- del: {
|
|
|
- btnType: 'text',
|
|
|
- prompt: '确定删除吗?',
|
|
|
- click: ({ row, index, column }) => {
|
|
|
- del({
|
|
|
- id: row.id
|
|
|
- }).then(res => {
|
|
|
- if (res.code == 200) {
|
|
|
- this.$message({ type: 'success', message: `删除成功!` })
|
|
|
- this.$refs.pageRef.refreshList()
|
|
|
- } else {
|
|
|
- this.$message.error(res.msg);
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
+ // 表格操作列
|
|
|
+ operation() {
|
|
|
+ return this.operationBtn({
|
|
|
+ del: {
|
|
|
+ btnType: 'text',
|
|
|
+ prompt: '确定删除吗?',
|
|
|
+ click: ({ row, index, column }) => {
|
|
|
+ del({
|
|
|
+ id: row.id
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message({ type: 'success', message: `删除成功!` })
|
|
|
+ this.$refs.pageRef.refreshList()
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
addData() {
|
|
|
this.formDialogType = 0
|
|
|
this.openForm()
|
|
|
},
|
|
|
openForm() {
|
|
|
- this.formDialog = true;
|
|
|
+ this.formDialog = true
|
|
|
},
|
|
|
formCancel() {
|
|
|
this.$refs.formRef.$refs.inlineForm.clearValidate()
|
|
@@ -127,7 +130,7 @@ export default {
|
|
|
formConfirm() {
|
|
|
this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
|
|
|
if (valid) {
|
|
|
- ([add, edit][this.formDialogType])(this.formData).then(res => {
|
|
|
+ ;[add, edit][this.formDialogType](this.formData).then(res => {
|
|
|
this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
|
|
|
this.formCancel()
|
|
|
this.$refs.pageRef.refreshList()
|
|
@@ -135,22 +138,24 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- handleDownload() {
|
|
|
- commonTemplateDownload({ name: '师傅分销员资料初始化.xlsx' }, `${this.$route.meta.title}`).then(res => {
|
|
|
- this.$message({
|
|
|
- message: '下载成功',
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
- }).catch(err => {
|
|
|
- this.$message.error('下载失败')
|
|
|
- })
|
|
|
- },
|
|
|
+ handleDownload() {
|
|
|
+ commonTemplateDownload({ name: '师傅分销员资料初始化.xlsx' }, `${this.$route.meta.title}`)
|
|
|
+ .then(res => {
|
|
|
+ this.$message({
|
|
|
+ message: '下载成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ this.$message.error('下载失败')
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
- .tab{
|
|
|
- padding: 20px 20px 0 20px;
|
|
|
- }
|
|
|
+.tab {
|
|
|
+ padding: 20px 20px 0 20px;
|
|
|
+}
|
|
|
</style>
|