{"remainingRequest":"/data/jenkins/workspace/mer.mall2.baibaodun.cn/node_modules/vue-loader/lib/index.js??vue-loader-options!/data/jenkins/workspace/mer.mall2.baibaodun.cn/src/views/product/attr/index.vue?vue&type=script&lang=js","dependencies":[{"path":"/data/jenkins/workspace/mer.mall2.baibaodun.cn/src/views/product/attr/index.vue","mtime":1720764823961},{"path":"/data/jenkins/workspace/mer.mall2.baibaodun.cn/node_modules/babel-loader/lib/index.js","mtime":456789000000},{"path":"/data/jenkins/workspace/mer.mall2.baibaodun.cn/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/mer.mall2.baibaodun.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//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\n// +----------------------------------------------------------------------\n// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]\n// +----------------------------------------------------------------------\n// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.\n// +----------------------------------------------------------------------\n// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权\n// +----------------------------------------------------------------------\n// | Author: CRMEB Team \n// +----------------------------------------------------------------------\n\nimport { templateListApi, attrDeleteApi } from '@/api/product';\nimport { checkPermi } from '@/utils/permission'; // 权限判断函数\nexport default {\n name: 'StoreAttr',\n data() {\n return {\n formDynamic: {\n ruleName: '',\n ruleValue: [],\n },\n tableFrom: {\n page: 1,\n limit: 20,\n keywords: '',\n },\n keywords: '',\n tableData: {\n data: [],\n loading: false,\n total: 0,\n },\n listLoading: false,\n selectionList: [],\n multipleSelectionAll: [],\n idKey: 'id',\n nextPageFlag: false,\n keyNum: 0,\n };\n },\n mounted() {\n if (checkPermi(['merchant:product:rule:page:list'])) this.getList();\n },\n methods: {\n checkPermi,\n seachList() {\n this.tableFrom.page = 1;\n this.getList();\n },\n handleSelectionChange(val) {\n this.selectionList = val;\n setTimeout(() => {\n this.$selfUtil.changePageCoreRecordData(\n this.multipleSelectionAll,\n this.multipleSelection,\n this.tableData.data,\n (e) => {\n this.multipleSelectionAll = e;\n },\n );\n }, 50);\n },\n // 设置选中的方法\n setSelectRow() {\n if (!this.multipleSelectionAll || this.multipleSelectionAll.length <= 0) {\n return;\n }\n // 标识当前行的唯一键的名称\n const idKey = this.idKey;\n const selectAllIds = [];\n this.multipleSelectionAll.forEach((row) => {\n selectAllIds.push(row[idKey]);\n });\n this.$refs.table.clearSelection();\n for (var i = 0; i < this.tableData.data.length; i++) {\n if (selectAllIds.indexOf(this.tableData.data[i][idKey]) >= 0) {\n // 设置选中,记住table组件需要使用ref=\"table\"\n this.$refs.table.toggleRowSelection(this.tableData.data[i], true);\n }\n }\n },\n add() {\n const _this = this;\n this.$modalAttr(\n Object.assign({}, this.formDynamic),\n function () {\n _this.getList();\n },\n (this.keyNum += 1),\n );\n },\n // 列表\n getList() {\n this.listLoading = true;\n this.tableFrom.keywords = encodeURIComponent(this.keywords);\n templateListApi(this.tableFrom)\n .then((res) => {\n const list = res.list;\n this.tableData.data = list;\n this.tableData.total = res.total;\n for (var i = 0; i < list.length; i++) {\n list[i].ruleValue = JSON.parse(list[i].ruleValue);\n }\n this.$nextTick(function () {\n this.setSelectRow(); // 调用跨页选中方法\n });\n this.listLoading = false;\n })\n .catch(() => {\n this.listLoading = false;\n });\n },\n pageChange(page) {\n this.$selfUtil.changePageCoreRecordData(\n this.multipleSelectionAll,\n this.multipleSelection,\n this.tableData.data,\n (e) => {\n this.multipleSelectionAll = e;\n },\n );\n this.tableFrom.page = page;\n this.getList();\n },\n handleSizeChange(val) {\n this.$selfUtil.changePageCoreRecordData(\n this.multipleSelectionAll,\n this.multipleSelection,\n this.tableData.data,\n (e) => {\n this.multipleSelectionAll = e;\n },\n );\n this.tableFrom.limit = val;\n this.getList();\n },\n // 删除\n handleDelete(id, idx) {\n this.$modalSure()\n .then(() => {\n attrDeleteApi(id).then(() => {\n this.$message.success('删除成功');\n this.tableData.data.splice(idx, 1);\n });\n })\n .catch(() => {});\n },\n handleDeleteAll() {\n if (!this.multipleSelectionAll.length) return this.$message.warning('请选择商品规格');\n const data = [];\n this.multipleSelectionAll.map((item) => {\n data.push(item.id);\n });\n this.ids = data.join(',');\n this.$modalSure()\n .then(() => {\n attrDeleteApi(this.ids).then(() => {\n this.$message.success('删除成功');\n this.getList();\n });\n })\n .catch(() => {});\n },\n onEdit(val) {\n const _this = this;\n this.$modalAttr(JSON.parse(JSON.stringify(val)), function () {\n _this.getList();\n });\n },\n },\n};\n",null]}