| | |
| | | data: data |
| | | }) |
| | | } |
| | | /* |
| | | * 修改物品规格型号状态 |
| | | * */ |
| | | export function updSpecsStatus(data) { |
| | | return request({ |
| | | url: '/pc/base/goods/models/updStatus', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | |
| | | myTable: { |
| | | url: '', |
| | | params: {}, |
| | | autoLoad: true, |
| | | border: false, |
| | | showIndex: true, // 是否显示序号 |
| | | expand: true, // 是否显示详情数据 |
| | |
| | | total: 0 |
| | | }) |
| | | } |
| | | this.$nextTick(() => { |
| | | this.search({ pageNum: 1 }) |
| | | }) |
| | | if (this.myTable.autoLoad) { |
| | | this.$nextTick(() => { |
| | | this.search({pageNum: 1}) |
| | | }) |
| | | } |
| | | this.myTable.columns.forEach((column, idx) => { |
| | | if (!column.hidden) { |
| | | this.checkColumns.push(idx) |
| | |
| | | updState(row) { |
| | | let vm = this |
| | | let text = row.states == 0 ? "启用" : "禁用"; |
| | | vm.$modal.confirm('确认要' + text + '"' + row.goodsName + '"吗?').then(function () { |
| | | vm.$modal.confirm('确认要' + text + '"' + row.goodsName + '"物品吗?').then(function () { |
| | | let params = Object.assign({}, row) |
| | | params.states = row.states == 1 ? 0 : 1 |
| | | updStatus(params).then(res => { |
| | |
| | | }, |
| | | del(row) { |
| | | this.$modal |
| | | .confirm('是否确认删除名称为"' + row.goodsName + '"的机构吗?') |
| | | .confirm('是否确认删除名称为"' + row.goodsName + '"的物品吗?') |
| | | .then(function () { |
| | | delGoods({id: row.id}).then((res) => { |
| | | }); |
| | |
| | | // } |
| | | }, |
| | | showSpecs(row) { |
| | | this.specsSetting.id = row.id; |
| | | this.specsSetting.goodsTemplatesId = row.id; |
| | | this.specsSetting.show = true; |
| | | }, |
| | | // 查询table列表 |
| | |
| | | <script> |
| | | import winMd from '@/components/win/win-md' |
| | | import myButton from '@/components/myButton/myButton' |
| | | import {delSpecs} from "@/api/foudation/material"; |
| | | import {delSpecs, updSpecsStatus} from "@/api/foudation/material"; |
| | | import specsAdd from "@/views/foundation/material/specs/specsAdd.vue"; |
| | | import {mapGetters} from 'vuex' |
| | | import MyTableV2 from "@/components/myTable/myTableV2.vue"; |
| | |
| | | }, |
| | | // 表格数据 |
| | | table: { |
| | | autoLoad: false, |
| | | showIndex: true, // 是否显示序号 |
| | | expand: false, // 是否显示详情数据 |
| | | dataIndex: 'goodsTemplatesId', |
| | |
| | | }, |
| | | // 列信息 |
| | | columns: [ |
| | | {title: '规格型号', field: 'goodsCode', align: 'left', minWidth: 120}, |
| | | {title: '单位', field: 'classification', align: 'center', width: 100}, |
| | | {title: '规格型号', field: 'modelName', align: 'left', minWidth: 120}, |
| | | {title: '单位', field: 'unit', align: 'center', width: 100}, |
| | | { |
| | | field: 'states', |
| | | title: '状态', |
| | |
| | | ], |
| | | }, |
| | | paging: { |
| | | show: true, // 显示分页 |
| | | show: false, // 显示分页 |
| | | // 分页信息 |
| | | page: { |
| | | small: false, |
| | |
| | | computed: { |
| | | ...mapGetters(['userInfo']) |
| | | }, |
| | | created() { |
| | | mounted() { |
| | | this.$nextTick(()=>{ |
| | | this.search() |
| | | }) |
| | | |
| | | }, |
| | | methods: { |
| | | showAdd(){ |
| | | this.specsSetting.mid = this.setting.id;//物品ID |
| | | this.specsSetting.goodsTemplatesId = this.setting.goodsTemplatesId;//物品ID |
| | | this.specsSetting.show = true; |
| | | }, |
| | | updState(row) { |
| | | let vm = this |
| | | let text = row.states == 0 ? "启用" : "禁用"; |
| | | vm.$modal.confirm('确认要' + text + '"' + row.modelName + '"规格吗?').then(function () { |
| | | let params = Object.assign({}, row) |
| | | params.states = row.states == 1 ? 0 : 1 |
| | | updSpecsStatus(params).then(res => { |
| | | if (res) { |
| | | row.states = row.states === 1 ? 0 : 1 |
| | | vm.$modal.msgSuccess(text + "成功"); |
| | | vm.search() |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | del(row) { |
| | | this.$modal |
| | | .confirm('是否确认删除名称为"' + row.categoryName + '"的机构吗?') |
| | | .confirm('是否确认删除名称为"' + row.modelName + '"的规格吗?') |
| | | .then(function () { |
| | | delSpecs({ id: row.id }).then((res) => {}); |
| | | }) |
| | |
| | | }, |
| | | // 查询table列表 |
| | | search() { |
| | | this.$refs.myTable.search() |
| | | this.$refs.myTable.search({goodsTemplatesId:this.specsSetting.goodsTemplatesId}) |
| | | }, |
| | | |
| | | } |
| | |
| | | this.$refs.ruleForm.validate((valid) => { |
| | | if (valid) { |
| | | const params = Object.assign({}, this.formData) |
| | | params.goodsTemplatesId = this.setting.goodsTemplatesId |
| | | if (this.loading) return |
| | | this.loading = true |
| | | addSpecs(params).then(res => { |
| | | this.loading = false |
| | | if (res) { |
| | | this.$message.success('保存成功!') |
| | | this.close() |
| | | this.$emit('search') |
| | | } else { |
| | | this.$message.error('保存失败') |
| | | } |
| | | this.$message.success('保存成功!') |
| | | this.close() |
| | | this.$emit('search') |
| | | }).catch(() => { |
| | | this.loading = false |
| | | }); |