{"remainingRequest":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/vue-loader/lib/index.js??vue-loader-options!/data/jenkins/workspace/mer.ws.baibaodun.com.cn/src/views/marketing/broadcast/assistant/index.vue?vue&type=script&lang=js","dependencies":[{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/src/views/marketing/broadcast/assistant/index.vue","mtime":1701742078554},{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/babel-loader/lib/index.js","mtime":456789000000},{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/mer.ws.baibaodun.com.cn/node_modules/vue-loader/lib/index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\n// +----------------------------------------------------------------------\n// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权\n// +----------------------------------------------------------------------\n// | Author: CRMEB Team <admin@crmeb.com>\n// +----------------------------------------------------------------------\nimport {\n  liveAssistantSaveApi,\n  liveAssistantListApi,\n  liveAssistantUpdateApi,\n  liveAssistantDelApi,\n} from '@/api/marketing';\nimport { checkPermi } from '@/utils/permission'; // 权限判断函数\nexport default {\n  name: 'AssistantList',\n  data() {\n    return {\n      listLoading: true,\n      tableData: {\n        data: [],\n        total: 0,\n      },\n      tableForm: {\n        page: 1,\n        limit: 20,\n        keywords: '',\n      },\n      keywords: '',\n      loading: false,\n      keyNum: 0,\n    };\n  },\n  watch: {},\n  mounted() {\n    if (checkPermi(['merchant:mp:live:assistant:list'])) this.getList('');\n  },\n  methods: {\n    checkPermi,\n    handleEdit(isCreate, editDate) {\n      const _this = this;\n      this.id = editDate ? editDate.id : 0;\n      this.$modalParserFrom(\n        isCreate === 0 ? '新建小助手' : '编辑小助手',\n        'liveAssistant',\n        isCreate,\n        isCreate === 0\n          ? {\n              id: 0,\n              wechat: '',\n              wechatNickname: '',\n              assDesc: '',\n            }\n          : Object.assign({}, editDate),\n        function (formValue) {\n          _this.submit(formValue);\n        },\n        (this.keyNum += 1),\n      );\n    },\n    //表单提交\n    submit(formValue) {\n      const data = {\n        id: this.id,\n        wechat: formValue.wechat,\n        wechatNickname: formValue.wechatNickname,\n        assDesc: formValue.assDesc,\n      };\n      !this.id\n        ? liveAssistantSaveApi(data)\n            .then((res) => {\n              this.$message.success('操作成功');\n              this.$msgbox.close();\n              this.getList();\n            })\n            .catch(() => {\n              this.loading = false;\n            })\n        : liveAssistantUpdateApi(data)\n            .then((res) => {\n              this.$message.success('操作成功');\n              this.$msgbox.close();\n              this.getList();\n            })\n            .catch(() => {\n              this.loading = false;\n            });\n    },\n    // 列表\n    getList(num) {\n      this.listLoading = true;\n      this.tableForm.page = num || this.tableForm.page;\n      this.tableForm.keywords = encodeURIComponent(this.keywords);\n      liveAssistantListApi(this.tableForm)\n        .then((res) => {\n          this.tableData.data = res.list;\n          this.tableData.total = res.total;\n          this.listLoading = false;\n        })\n        .catch((res) => {\n          this.listLoading = false;\n        });\n    },\n    pageChange(page) {\n      this.tableForm.page = page;\n      this.getList('');\n    },\n    handleSizeChange(val) {\n      this.tableForm.limit = val;\n      this.getList('');\n    },\n    // 删除\n    handleDelete(id, idx) {\n      this.$modalSure('删除该直播助手吗？').then(() => {\n        liveAssistantDelApi(id).then(() => {\n          this.$message.success('删除成功');\n          if (this.tableData.data.length === 1 && this.tableForm.page > 1)\n            this.tableForm.page = this.tableForm.page - 1;\n          this.getList('');\n        });\n      });\n    },\n  },\n};\n",null]}