Commit b84a9f1d authored by jack_liu's avatar jack_liu

修改

parent 74b1892b
...@@ -71,11 +71,7 @@ ...@@ -71,11 +71,7 @@
<el-row style="padding-left: 8.6%; padding-top: 1%"> <el-row style="padding-left: 8.6%; padding-top: 1%">
<el-col :span="12"> <el-col :span="12">
<el-form-item style="flex-basis: 50%"> <el-form-item style="flex-basis: 50%">
<el-button <el-button type="primary" @click="onSubmit">提交</el-button>
type="primary"
@click="onSubmit"
>提交</el-button
>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -84,7 +80,7 @@ ...@@ -84,7 +80,7 @@
</template> </template>
<script> <script>
import { getDictList, submit } from '@/api/production/gxpn' import { getDictList, submit, getlist } from '@/api/production/gxpn'
export default { export default {
name: 'Role', name: 'Role',
data() { data() {
...@@ -97,7 +93,7 @@ export default { ...@@ -97,7 +93,7 @@ export default {
dictSelection: [], dictSelection: [],
queryParams: { queryParams: {
ptype: '' ptype: ''
}, }
} }
}, },
created() { created() {
...@@ -114,22 +110,40 @@ export default { ...@@ -114,22 +110,40 @@ export default {
}, },
//提交按钮 //提交按钮
onSubmit() { onSubmit() {
console.log(this.dictSelection)
console.log(this.dictSelection)
if( this.queryParams.ptype === '' ){
this.$message.error('ptype为空,不允许提交')
return;
}
submit(this.dictSelection).then(res => { if (this.queryParams.ptype === '') {
this.$message.error('ptype为空,不允许提交')
return
}
if (this.dictSelection.length === 0) {
return
}
getlist(this.queryParams).then(res => {
const ptypeList = res.data
if (ptypeList.length == 0) {
this.$refs.dictTable.clearSelection()
}
ptypeList.forEach(row => {
this.dictList.forEach(item => {
if (row.pgx === item.dictValue) {
this.$refs.dictTable.toggleRowSelection(item, true)
}
})
})
this.$nextTick(() => {
submit({
list: this.dictSelection,
ptype: this.queryParams.ptype
}).then(res => {
if (res.code === 200) { if (res.code === 200) {
this.$message.success('提交成功') this.$message.success('提交成功')
this.$refs.dictTable.clearSelection() /* this.$refs.dictTable.clearSelection()
this.queryParams.ptype = '' this.queryParams.ptype = '' */
} }
}) })
})
})
}, },
//查询 //查询
handleQuery() { handleQuery() {
...@@ -138,14 +152,15 @@ export default { ...@@ -138,14 +152,15 @@ export default {
if (this.queryParams.ptype == '') { if (this.queryParams.ptype == '') {
return return
} }
getDictList({ getlist(this.queryParams).then(res => {
dictLabel: this.queryParams.ptype const ptypeList = res.data
}).then(res => { if (ptypeList.length == 0) {
const dictList = res.data this.$refs.dictTable.clearSelection()
this.dictList.forEach(row => { }
dictList.forEach(item => { ptypeList.forEach(row => {
if (row.businessId === item.businessId) { this.dictList.forEach(item => {
this.$refs.dictTable.toggleRowSelection(row, true) if (row.pgx === item.dictValue) {
this.$refs.dictTable.toggleRowSelection(item, true)
} }
}) })
}) })
...@@ -183,5 +198,4 @@ export default { ...@@ -183,5 +198,4 @@ export default {
height: 12em; height: 12em;
width: 4px; width: 4px;
} }
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment