Commit 9aa58dd5 by wangweidong

分包方

parent 44e2ebe7
<template> <template>
<div> <div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24" style="margin-top: 10px">
<Form v-show="searchOpen" id="search-form" inline onsubmit="return false" :label-width="90">
<label class="label-sign"></label>
<Form-item class="search-item" label="实验室名称:">
<Input name="name" placeholder="请输入实验室名称" clearable @on-enter="_formSearch"/>
</Form-item>
<Form-item class="search-item" label="资质:">
<Input name="aptitude" placeholder="请输入资质" clearable @on-enter="_formSearch"/>
</Form-item>
<Form-item class="search-item" label="检测项目:">
<Input name="itemName" placeholder="请输入检测项目" clearable @on-enter="_formSearch"/>
</Form-item>
<Form-item class="search-btn">
<Button type="primary" @click="_formSearch">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<BtnList :msg="btn" class="contHide" :open="searchOpen" :show-search-btn="true"
@on-result-change="_btnClick"></BtnList>
</Col>
<!--表格-->
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" <PTVXETable ref="pageTable" :table-height="tableHeight"
:get-page="getPage" :icon-msg="iconMsg" hide-checkbox @on-result-change="_tableResultChange"> :get-page="getPage" :icon-msg="iconMsg" hide-checkbox @on-result-change="_tableResultChange">
<vxe-table-column <vxe-table-column
...@@ -14,21 +44,51 @@ ...@@ -14,21 +44,51 @@
</template> </template>
</vxe-table-column> </vxe-table-column>
</PTVXETable> </PTVXETable>
</Col>
</Row>
</div>
</div>
</div> </div>
</template> </template>
<script> <script>
import PTVXETable from '../../../components/table/PTVXETable'
export default { export default {
name: 'MeterSubcontractor', components: {},
comments: {
PTVXETable
},
data() { data() {
return { return {
currentComponent: '',
searchOpen: false,
btn: [
{
type: 'success',
id: '',
name: '添加',
componentName: 'FoodSubcontracterEdit'
}
],
iconMsg: [
{
type: 'compose',
id: '',
name: '编辑',
componentName: 'FoodSubcontracterEdit'
},
{
type: 'stats-bars',
id: '',
name: '资质项目',
componentName: 'FoodSubcontracterItem'
},
{ type: 'cloud', id: '', name: '附件', componentName: 'FileManage' },
{ type: 'trash-a', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志',
componentName: 'FoodSubRecord'
}
],
selectIds: [],
getPage: {}, getPage: {},
tableHeight: 500,
iconMsg: [],
pageColumns: [ pageColumns: [
{ title: '实验室名称', key: 'name', width: 200 }, { title: '实验室名称', key: 'name', width: 200 },
{ title: '资质', key: 'aptitude', width: 200 }, { title: '资质', key: 'aptitude', width: 200 },
...@@ -41,11 +101,66 @@ export default { ...@@ -41,11 +101,66 @@ export default {
] ]
} }
}, },
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('search')
} else {
return this.$tableHeight('noSearch')
}
}
},
mounted() {
this._page()
},
methods: { methods: {
_modalResult() {
if (this.currentComponent === 'FoodSubcontracterEdit') {
this._page()
}
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '添加':
this._editModal(false)
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '编辑':
this._editModal(true, data.id)
break
case '资质项目':
this._itemModal(data.id)
break
case '附件':
this._upload(data.id)
break
case '删除':
this._deleteByIds([data.id])
break
case '操作日志':
this._record(data.id)
break
}
})
},
_record(id) {
this.$refs.refModal._open(id)
},
_tableResultChange(msg, data) { _tableResultChange(msg, data) {
switch (msg) { switch (msg) {
case 'page': case 'page':
this.getPage = {} this.getPage = this.$store.state.FoodSubcontracter.page
break break
case 'iconClick': case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName) this._iconClick(data.name, data.rowData, data.componentName)
...@@ -54,10 +169,51 @@ export default { ...@@ -54,10 +169,51 @@ export default {
this._page() this._page()
break break
} }
},
_page() {
alert(123)
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
// 删除
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this.$store
.dispatch('FoodSubcontracter/deleteByIds', ids)
.then(() => {
if (this.$store.state.FoodSubcontracter.success) {
this._page()
this.$Message.success('删除成功!')
}
})
}
})
},
// 编辑&添加
_editModal(edit, id) {
if (edit) {
// 编辑
this.$store.dispatch('FoodSubcontracter/getById', id).then(() => {
this.$refs.refModal._open(this.$store.state.FoodSubcontracter.model)
})
} else {
// 添加
this.$refs.refModal._open()
}
},
// 追加项目
_itemModal(data) {
this.$refs.refModal._open(data)
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
} }
} }
} }
</script> </script>
<style scoped>
</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