From 4ef5c9ad2903bd82d50e4892814b8c7c534a7ec3 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 21 九月 2023 14:15:47 +0800
Subject: [PATCH] 属性对比
---
company_admin/src/views/business/goods.vue | 318 ++++++++++++++++++++++++++--------------------------
1 files changed, 159 insertions(+), 159 deletions(-)
diff --git a/company_admin/src/views/business/goods.vue b/company_admin/src/views/business/goods.vue
index d1d0c5a..48e5642 100644
--- a/company_admin/src/views/business/goods.vue
+++ b/company_admin/src/views/business/goods.vue
@@ -151,165 +151,165 @@
<selectProduct ref="selectProduct" @success="handlePageChange" @result="search"/>
</TableLayout>
</template>
-
- <script>
- import BaseTable from '@/components/base/BaseTable'
- import TableLayout from '@/layouts/TableLayout'
- import Pagination from '@/components/common/Pagination'
- import OperaGoodsWindow from '@/components/business/OperaGoodsWindow'
- import selectProduct from '@/components/business/selectProduct'
- import { brand, category, importExcel } from '@/api/system/common.js'
- import { updateDisableById, queryById, exportDoc, batchUpdateDisableById } from '@/api/business/goods.js'
- export default {
- name: 'Goods',
- extends: BaseTable,
- components: { TableLayout, Pagination, OperaGoodsWindow, selectProduct },
- data () {
- return {
- // 鎼滅储
- searchForm: {
- id: '',
- name: '',
- status: '',
- categoryId: '',
- brandId: '',
- type: ''
- },
- ids: '',
- categoryList: [],
- brandList: [],
- statusList: [
- { name: '鍚敤', id: 0 },
- { name: '绂佺敤', id: 1 }
- ],
- typeList: [
- { name: '鑷缓', id: 0 },
- { name: '鎷夊彇', id: 1 }
- ]
- }
- },
- created () {
- this.config({
- module: '鍟嗗搧',
- api: '/business/goods',
- 'field.id': 'id',
- 'field.main': 'name'
- })
- this.search()
- this.getbrand()
- this.getcategory()
- },
- methods: {
- handleSelectionChange(e) {
- let arr = e.map(item => item.id)
- this.ids = arr.join(',')
- console.log(this.ids)
+<script>
+import BaseTable from '@/components/base/BaseTable'
+import TableLayout from '@/layouts/TableLayout'
+import Pagination from '@/components/common/Pagination'
+import OperaGoodsWindow from '@/components/business/OperaGoodsWindow'
+import selectProduct from '@/components/business/selectProduct'
+import { brand, category, importExcel } from '@/api/system/common.js'
+import { updateDisableById, queryById, exportDoc, batchUpdateDisableById } from '@/api/business/goods.js'
+export default {
+ name: 'Goods',
+ extends: BaseTable,
+ components: { TableLayout, Pagination, OperaGoodsWindow, selectProduct },
+ data () {
+ return {
+ // 鎼滅储
+ searchForm: {
+ id: '',
+ name: '',
+ status: '',
+ categoryId: '',
+ brandId: '',
+ type: ''
},
- // 鎵归噺涓婁笅鏋�
- bulkOperation(type) {
- if (!this.ids) {
- this.$message.warning({ message: '鑷冲皯閫夋嫨涓�椤瑰唴瀹�' })
- return
- }
- batchUpdateDisableById({
- ids: this.ids,
- status: type
- }).then(res => {
- this.$message.success({ message: res })
- this.handlePageChange()
- })
- },
- downloadFile() {
- exportDoc({})
- .then(response => {
- this.download(response)
- })
- .catch(e => {
- this.$tip.apiFailed(e)
- })
- },
- rowStyle() {
- return "text-align:center";
- },
- importFile() {
- this.$refs.upload.click()
- },
- uplaodFile(e) {
- const FORMDATE = new FormData()
- FORMDATE.append('file', e.target.files[0])
- // 璇锋眰鎺ュ彛
- importExcel(FORMDATE)
- .then(res => {
- console.log(res)
- this.search()
- })
- .catch ((err) => {
- this.$message.error(err.message)
- })
- this.$refs.upload.value = null
- },
- edit(id) {
- queryById(id)
- .then(res => {
- let obj = {
- id: res.id,
- name: res.name,
- categoryId: res.categoryId,
- brandId: res.brandId,
- zdPrice: res.zdPrice,
- price: res.price,
- attrFirstIds: res.attrFirstIds ? this.turnNum(res.attrFirstIds.split(',')) : [],
- attrFirstNames: res.attrFirstNames,
- attrSecodIds: res.attrSecodIds ? this.turnNum(res.attrSecodIds.split(',')) : [],
- attrSecodNames: res.attrSecodNames,
- imgurl: res.imgurl,
- multifileList: [],
- files: [],
- ztList: res.imgurl ? [{ url: res.prefixUrl + res.imgurl }] : [],
- pzList: [],
- attrFirstList: [],
- attrSecodList: []
- }
- if (res.multifileList.length > 0) {
- res.multifileList.forEach(item => {
- obj.multifileList.push({ fileurl: item.fileurl, name: item.name, url: res.prefixUrl + item.fileurl })
- obj.files.push({ fileurl: item.fileurl, name: item.name, url: res.prefixUrl + item.fileurl })
- })
- }
- this.$refs.operaGoodsWindow.open('缂栬緫鍟嗗搧', obj)
- })
- },
- changeStatus(item) {
- updateDisableById({
- id: item.id,
- status: item.status
- }).then(res => {
- this.$tip.apiSuccess('鏇存柊鎴愬姛')
- }).finally(() => {
- this.search()
- }).catch(err => {
- this.$message.warning({ message: err.message })
- })
- },
- turnNum (nums) {
- for(let i=0;i<nums.length;i++){
- nums[i] = parseInt(nums[i])
- }
- return nums;
- },
- getbrand() {
- brand({})
- .then(res => {
- this.brandList = res
- })
- },
- getcategory() {
- category({})
- .then(res => {
- this.categoryList = res
- })
- }
+ ids: '',
+ categoryList: [],
+ brandList: [],
+ statusList: [
+ { name: '鍚敤', id: 0 },
+ { name: '绂佺敤', id: 1 }
+ ],
+ typeList: [
+ { name: '鑷缓', id: 0 },
+ { name: '鎷夊彇', id: 1 }
+ ]
}
+ },
+ created () {
+ this.config({
+ module: '鍟嗗搧',
+ api: '/business/goods',
+ 'field.id': 'id',
+ 'field.main': 'name'
+ })
+ this.search()
+ this.getbrand()
+ this.getcategory()
+ },
+ methods: {
+ // handleSelectionChange(e) {
+ // let arr = e.map(item => item.id)
+ // this.ids = arr.join(',')
+ // console.log(this.ids)
+ // },
+ // 鎵归噺涓婁笅鏋�
+ bulkOperation (type) {
+ if (this.tableData.selectedRows.length === 0) {
+ // if (!this.ids) {
+ this.$message.warning({ message: '鑷冲皯閫夋嫨涓�椤瑰唴瀹�' })
+ return
+ }
+ const idList = this.tableData.selectedRows.map(item => item.id)
+ batchUpdateDisableById({
+ ids: idList.join(','),
+ status: type
+ }).then(res => {
+ this.$message.success({ message: res })
+ this.handlePageChange()
+ })
+ },
+ downloadFile() {
+ exportDoc({})
+ .then(response => {
+ this.download(response)
+ })
+ .catch(e => {
+ this.$tip.apiFailed(e)
+ })
+ },
+ rowStyle() {
+ return "text-align:center";
+ },
+ importFile() {
+ this.$refs.upload.click()
+ },
+ uplaodFile(e) {
+ const FORMDATE = new FormData()
+ FORMDATE.append('file', e.target.files[0])
+ // 璇锋眰鎺ュ彛
+ importExcel(FORMDATE)
+ .then(res => {
+ console.log(res)
+ this.search()
+ })
+ .catch ((err) => {
+ this.$message.error(err.message)
+ })
+ this.$refs.upload.value = null
+ },
+ edit(id) {
+ queryById(id)
+ .then(res => {
+ let obj = {
+ id: res.id,
+ name: res.name,
+ categoryId: res.categoryId,
+ brandId: res.brandId,
+ zdPrice: res.zdPrice,
+ price: res.price,
+ attrFirstIds: res.attrFirstIds ? this.turnNum(res.attrFirstIds.split(',')) : [],
+ attrFirstNames: res.attrFirstNames,
+ attrSecodIds: res.attrSecodIds ? this.turnNum(res.attrSecodIds.split(',')) : [],
+ attrSecodNames: res.attrSecodNames,
+ imgurl: res.imgurl,
+ multifileList: [],
+ files: [],
+ ztList: res.imgurl ? [{ url: res.prefixUrl + res.imgurl }] : [],
+ pzList: [],
+ attrFirstList: [],
+ attrSecodList: []
+ }
+ if (res.multifileList.length > 0) {
+ res.multifileList.forEach(item => {
+ obj.multifileList.push({ fileurl: item.fileurl, name: item.name, url: res.prefixUrl + item.fileurl })
+ obj.files.push({ fileurl: item.fileurl, name: item.name, url: res.prefixUrl + item.fileurl })
+ })
+ }
+ this.$refs.operaGoodsWindow.open('缂栬緫鍟嗗搧', obj)
+ })
+ },
+ changeStatus(item) {
+ updateDisableById({
+ id: item.id,
+ status: item.status
+ }).then(res => {
+ this.$tip.apiSuccess('鏇存柊鎴愬姛')
+ }).finally(() => {
+ this.search()
+ }).catch(err => {
+ this.$message.warning({ message: err.message })
+ })
+ },
+ turnNum (nums) {
+ for(let i=0;i<nums.length;i++){
+ nums[i] = parseInt(nums[i])
+ }
+ return nums;
+ },
+ getbrand() {
+ brand({})
+ .then(res => {
+ this.brandList = res
+ })
+ },
+ getcategory() {
+ category({})
+ .then(res => {
+ this.categoryList = res
+ })
+ }
}
- </script>
-
\ No newline at end of file
+}
+</script>
\ No newline at end of file
--
Gitblit v1.9.3