From 8b46c471e28fbf0b71efbe363facf0bf05d8f6f8 Mon Sep 17 00:00:00 2001 From: nidapeng <jp@doumee.com> Date: 星期四, 14 三月 2024 18:12:30 +0800 Subject: [PATCH] aaa --- company/src/components/business/modification.vue | 230 +++++++++++++++++++++++++++++++-------------------------- 1 files changed, 126 insertions(+), 104 deletions(-) diff --git a/company/src/components/business/modification.vue b/company/src/components/business/modification.vue index d832b5f..b0e28c8 100644 --- a/company/src/components/business/modification.vue +++ b/company/src/components/business/modification.vue @@ -34,6 +34,20 @@ </el-select> </template> </el-table-column> + <el-table-column + align="center" + label="濮旀墭鍟嗘埛"> + <template slot-scope="scope"> + <el-select v-model="scope.row.shopId" clearable="true" value-key="id" placeholder="璇烽�夋嫨"> + <el-option + v-for="item in shops" + :key="item.id" + :label="item.name" + :value="item.id"> + </el-option> + </el-select> + </template> + </el-table-column> <el-table-column align="center" label="鍔犲噺淇濆姛鑳�"> @@ -55,110 +69,118 @@ </template> <script> - import BaseOpera from '@/components/base/BaseOpera' - import GlobalWindow from '@/components/common/GlobalWindow' - import { all } from '@/api/business/solutions' - import { listForCompany } from '@/api/business/solutions' - import { updateSolutions } from '@/api/business/company' +import BaseOpera from '@/components/base/BaseOpera' +import GlobalWindow from '@/components/common/GlobalWindow' +import { all, listForCompany } from '@/api/business/solutions' - export default { - name: 'modification', - extends: BaseOpera, - components: { GlobalWindow }, - data () { - return { - // 琛ㄥ崟鏁版嵁 - form: { - id: null, - solutionList: [ - { - solution: { id: null, baseId: null }, - canAdd: 0, - canReduce: 0 - } - ] - }, - // 楠岃瘉瑙勫垯 - rules: { - solutionList: [ - { required: true, message: '璇疯緭鍏ュ叕鍙歌处鍙�' } - ] - }, - programme: [] - } - }, - created () { - this.config({ - api: '/business/company', - 'field.id': 'id' - }) - }, - methods: { - changeSolution(e, index) { - let baseId = '' - this.programme.forEach(item => { - if (item.id === e) { - baseId = item.baseId - } - }) - this.form.solutionList[index].solution.baseId = baseId - }, - confirm() { - this.isWorking = true - updateSolutions(this.form) - .then(res => { - this.visible = false - this.$tip.apiSuccess('鏂板缓鎴愬姛') - this.$emit('success') - }) - .catch(e => { - this.$tip.apiFailed(e) - }) - .finally(() => { - this.isWorking = false - }) - }, - // 鑾峰彇鍏ㄩ儴鏂规 - getAll() { - all({ dataType: 2 }) - .then(res => { - this.programme = res - }) - }, - open (title, target) { - var that = this; - this.title = title - for (const key in this.form) { - this.form[key] = target[key] - } - this.getAll() - listForCompany({ companyId: target.id }) - .then(resa => { - that.form.solutionList = resa.map(item => { - return { - solution: {id: item.solutionId, baseId: item.solutionBaseId }, - canAdd: item.canAdd, - canReduce: item.canReduce - } - }) - console.log(that.form.solutionList) - that.visible = true - }) - }, - add() { - this.form.solutionList.push({ - solution: { id: null, baseId: null }, - canAdd: '', - canReduce: '' - }) - }, - dele(index) { - if (this.form.solutionList.length === 1) { - this.$message.warning('鑷冲皯淇濈暀涓�椤�') - return - } - this.form.solutionList.splice(index, 1) - } - } +import { updateSolutions, pageAll as shopList } from '@/api/business/company' + +export default { + name: 'modification', + extends: BaseOpera, + components: { GlobalWindow }, + data () { + return { + // 琛ㄥ崟鏁版嵁 + form: { + id: null, + solutionList: [ + { + solution: { id: null, baseId: null }, + canAdd: 0, + canReduce: 0 + } + ] + }, + // 楠岃瘉瑙勫垯 + rules: { + solutionList: [ + { required: true, message: '璇疯緭鍏ュ叕鍙歌处鍙�' } + ] + }, + programme: [], + shops: [] } + }, + created () { + this.config({ + api: '/business/company', + 'field.id': 'id' + }) + }, + methods: { + changeSolution (e, index) { + let baseId = '' + this.programme.forEach(item => { + if (item.id === e) { + baseId = item.baseId + } + }) + this.form.solutionList[index].solution.baseId = baseId + }, + confirm () { + this.isWorking = true + updateSolutions(this.form) + .then(res => { + this.visible = false + this.$tip.apiSuccess('鏂板缓鎴愬姛') + this.$emit('success') + }) + .catch(e => { + this.$tip.apiFailed(e) + }) + .finally(() => { + this.isWorking = false + }) + }, + // 鑾峰彇鍏ㄩ儴鏂规 + getAll () { + all({ dataType: 2 }) + .then(res => { + this.programme = res + }) + shopList({ type: 1, status: 0 }) + .then(res => { + console.log(res) + this.shops = res + }) + }, + open (title, target) { + var that = this + this.title = title + for (const key in this.form) { + this.form[key] = target[key] + } + this.getAll() + listForCompany({ companyId: target.id }) + .then(resa => { + that.form.solutionList = resa.map(item => { + return { + solution: { id: item.solutionId, baseId: item.solutionBaseId }, + shopId: item.shopId, + canAdd: item.canAdd, + canReduce: item.canReduce + } + }) + console.log(that.form.solutionList) + that.visible = true + }) + }, + add () { + this.form.solutionList.push({ + solution: { id: null, baseId: null }, + shopId: null, + canAdd: '', + canReduce: '' + }) + }, + dele (index) { + if (this.form.solutionList.length === 1) { + this.$message.warning('鑷冲皯淇濈暀涓�椤�') + return + } + this.form.solutionList.splice(index, 1) + } + } +} </script> -- Gitblit v1.9.3