Commit 91ee90a1 by lichengming

修改了委托登记

parent f492fbe5
......@@ -27,3 +27,4 @@ export { default as workbench } from './meter/workbench/workbench'
export { default as meterEntrust } from './meter/meter-entrust'
export { default as meterSample } from './meter/meter-sample'
export { default as soilAptitude } from './soil/soil-aptitude'
export { default as soilEntrust } from './soil/soil-entrust'
/**
* 工作台
*/
import http from '../http'
// import { https } from '../https'
export default {
// page
page: data => http.post('soil/v1/entrust/page', data).then(res => res),
getVOById: data => http.get('soil/v1/entrust/' + data).then(res => res),
deleteById: data => http.delete('soil/v1/entrust/' + data).then(res => res)
}
......@@ -82,7 +82,6 @@ export default {
},
watch: {
value: function(newVal, oldVal) {
console.log(newVal)
this.dataValue = newVal
}
},
......@@ -123,7 +122,7 @@ export default {
},
// 聚焦
_inputFocus() {
console.log('下拉选项', this.downData, this.showKey)
// console.log('下拉选项', this.downData, this.showKey)
// this.isFocus = true;
if (this.focus !== undefined) {
this.$emit('on-result-change', 'focus', '', this.dataHandObj)
......@@ -133,17 +132,26 @@ export default {
}
</script>
<style>
.ivu-modal-mask {
z-index: 1000 !important;
}
.ivu-modal-wrap {
z-index: 1000 !important;
}
/*.ivu-modal-mask {*/
/* z-index: 1000 !important;*/
/*}*/
/*.ivu-modal-wrap {*/
/* z-index: 1000 !important;*/
/*}*/
.iview-input-error .ivu-input {
border: 1px solid #eb6877 !important;
}
/*.el-dropdown-menu__item {*/
/* z-index: 3000 !important;*/
/* max-width: 400px !important;*/
/*}*/
.el-dropdown-menu {
z-index: 2147483647 !important;
}
.el-select-dropdown {
z-index: 2147483647 !important;
}
.el-dropdown-menu__item {
z-index: 3000 !important;
max-width: 400px !important;
}
</style>
<template>
<div>
<div class="layout-content-padding">
<div class="layout-content-main">
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="待完成" name="wait">
<MeterSendEntrust ref="waitTabs"></MeterSendEntrust>
</el-tab-pane>
<el-tab-pane label="历史记录" name="his">
<MeterSendEntrustHis ref="hisTabs"></MeterSendEntrustHis>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import MeterSendEntrust from './EntrustRegister'
import MeterSendEntrustHis from './EntrustRegisterHis'
export default {
name: 'MeterSendEntrustIndex',
components: {
MeterSendEntrust,
MeterSendEntrustHis
},
data() {
return {
activeName: 'wait'
}
},
mounted() {
this.activeName = 'wait'
this._page()
},
methods: {
_changeTabs(tab, event) {
if (tab.name === 'wait') {
this._page()
} else {
this.$refs.hisTabs._page()
}
},
_page() {
this.$refs.waitTabs._page()
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24" style="margin-top: 10px">
<Form id="formId" v-show="searchOpen" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="委托商:">
<Input v-model="formObj.client" @on-enter="_formSearch" name="client" placeholder="请输入委托单位" clearable/>
</Form-item>
<Form-item class="search-item" label="委托编号:">
<Input v-model="formObj.entrustCode" @on-enter="_formSearch" name="entrustCode" placeholder="请输入委托编号" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" @on-result-change="_btnClick"
class="contHide"></btn-list>
</Col>
<!--表格-->
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
<span v-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
<!-- <span v-else-if="item.status">{{scope.row[item.key].display}}</span>-->
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<FileManage ref="FileManage"></FileManage>
<Operation ref="operationModal"></Operation>
<EntrustRegisterEdit ref="editModal" @on-result-change="_formSearch"></EntrustRegisterEdit>
</div>
</template>
<script>
import { soilAptitude, soilEntrust } from '../../../api'
import http from '../../../api/http'
import Operation from '../../../components/operation/Operation'
import EntrustRegisterEdit from './EntrustRegisterEdit'
export default {
components: { Operation, EntrustRegisterEdit },
data() {
return {
currentComponent: '',
formId: 'meterSubcontractorFormId',
searchOpen: false,
btn: [
{
type: 'success',
id: '',
name: '添加'
}
// ,
// {
// type: 'success',
// id: '',
// name: '提交至评审'
// },
// {
// type: 'success',
// id: '',
// name: '提交'
// }
],
iconMsg: [
{
type: 'md-create',
id: '',
name: '编辑'
},
// {
// type: 'ios-beaker',
// id: '',
// name: '管理样品'
// },
{
type: 'md-cloud',
id: '',
name: '附件'
},
// {
// type: 'md-document',
// id: '',
// name: '导出委托单'
// },
{
type: 'md-remove-circle',
id: '',
name: '删除'
},
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
formObj: {
client: undefined,
contractCode: undefined,
entrustCode: undefined
},
selectIds: [],
getPage: {},
pageColumns: [
{ title: '委托商', key: 'client', width: 200 },
{ title: '委托编号', key: 'entrustCode', width: 120 },
{ title: '委托日期', key: 'entrustDate', width: 120, date: true },
{ title: '钻孔位置', key: 'boreholeLocation', width: 120 },
{ title: '水深(米)', key: 'waterDepth', width: 120 },
{ title: '钻孔名称', key: 'boreholeName', width: 120 },
{ title: '进度', key: 'progress', width: 120, status: true },
{ title: '工程号', key: 'projectNo', width: 120 },
{ title: '报告编号', key: 'reportCode', width: 120 },
{ title: '制表日期', key: 'tabulateDate', width: 120, date: true },
{ title: '制表人', key: 'tabulater', width: 120 },
{ title: '批准日期', key: 'approveDate', width: 120, date: true },
{ title: '批准人', key: 'approver', width: 120 },
{ title: '检验类别', key: 'testType', width: 120 }
]
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('search')
} else {
return this.$tableHeight('noSearch')
}
}
},
mounted() {
this._page()
},
methods: {
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '添加':
this._editModal(false)
break
case '提交至评审':
this._submitToReview()
break
case '提交':
this._submitToSkipReview()
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._sampleManage(data.id)
break
case '附件':
this._upload(data.id)
break
case '导出委托单':
this._exportEntrust(data.id)
break
case '删除':
this._deleteByIds([data.id])
break
case '操作日志':
this._record(data.id)
break
}
})
},
_sampleManage(data) {
// 管理样品
this.$refs.meterSampleManageModal._open(data)
},
_submitToReview() {
this._submitByContractIds('委托评审')
},
_submitToSkipReview() {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定要提交 ' + ids.length + ' 条记录?',
onOk: () => {
this._subToSkipRe(ids)
}
})
}
},
_submitByContractIds(cont) {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定要把这 ' + ids.length + ' 条记录提交到' + cont + '?',
onOk: () => {
this._subToRe(ids)
}
})
}
},
_subToRe: async function(ids) {
const result = await soilAptitude.submit(ids)
if (result) {
this._resultChange('提交成功')
}
},
_subToSkipRe: async function(ids) {
const result = await soilAptitude.submitSkipReview(ids)
if (result) {
this._resultChange('提交成功')
}
},
_resultChange(msg) {
this.$Message.success(msg)
this._page()
},
_record(id) {
this.$refs.operationModal._open(id)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilEntrust.page(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
// 删除
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._delete(ids)
}
})
},
// 编辑&添加
_editModal(edit, id) {
if (edit) {
// 编辑
this._getById(id)
} else {
// 添加
this.$refs.editModal._open()
}
},
// 追加项目
_itemModal(data) {
this.$refs.refModal._open(data)
},
_upload(id) {
// 上传文件
this.$refs.FileManage._open(id, 'contractId')
},
_exportEntrust(id) {
this.$Modal.confirm({
title: '提示',
content: '确定导出委托单?',
onOk: () => {
http.open('/meter/v1/entrust/export_send_entrust/?id=' + id)
}
})
},
_getById: async function(id) {
const result = await soilEntrust.getVOById(id)
if (result) {
this.$refs.editModal._openEdit(result)
}
},
_delete: async function(ids) {
const result = await soilEntrust.deleteById(ids)
if (result) {
this._formSearch()
this.$Message.success('删除成功!')
}
}
}
}
</script>
<template>
<div>
<Modal v-model="showModal" :mask-closable="false" width="1250">
<p slot="header">{{modalTitle}}</p>
<div>
<Form id="MeterSendTestEdit" ref="formObj" :model="formObj" :rules="ruleValidate" :label-width="90" inline>
<Form-item label="委托商" prop="client" class="width-48">
<AutoComplete :value="formObj.client" :down-data="customerData" @on-result-change="_cusNameChange"
name="client" placeholder="请输入或选择委托单位"
></AutoComplete>
</Form-item>
<Form-item label="委托日期:" prop="entrustDate" class="width-48">
<Date-picker v-model="formObj.entrustDate" @on-change="_ctimeChange" type="date" split-panels style="width:100%;"
placeholder="请选择委托日期"></Date-picker>
</Form-item>
<Form-item label="钻孔名称" prop="boreholeName" class="width-48">
<Input v-model="formObj.boreholeName" name="boreholeName" placeholder="请输入名称"/>
</Form-item>
<Form-item label="钻孔位置" prop="boreholeName" class="width-48">
<Input v-model="formObj.boreholeLocation" name="boreholeLocation" placeholder="请输入名称"/>
</Form-item>
<Form-item label="水深(米)" prop="waterDepth" class="width-48">
<Input v-model="formObj.waterDepth" name="waterDepth" placeholder="请输入名称"/>
</Form-item>
<Form-item label="制表日期" prop="tabulateDate" class="width-48">
<Input v-model="formObj.tabulateDate" name="tabulateDate" placeholder="请输入名称"/>
</Form-item>
<Form-item label="制表人" prop="tabulater" class="width-48">
<Input v-model="formObj.tabulater" name="tabulater" placeholder="请输入名称"/>
</Form-item>
<Form-item label="检验类别" prop="testType" class="width-48">
<Input v-model="formObj.testType" name="testType" placeholder="请输入名称"/>
</Form-item>
</Form>
</div>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult"></modal-footer>
</div>
</Modal>
<importModal ref="importModal" @on-result-change="_inputBack" aptitude-item></importModal>
</div>
</template>
<script>
/**
* 添加编辑分包商
*/
import { meterEntrust, meterSample } from '../../../api'
import importModal from '../../../components/import/DownloadTemplateImport'
import AutoComplete from '../../../components/base/AutoCompletes'
export default {
components: {
AutoComplete,
importModal
},
data() {
const validatefee = (rule, value, callback) => {
if (this.formObj.operation.fee === '') {
callback(new Error('内容不能为空'))
} else {
callback()
}
}
const validateRemark = (rule, value, callback) => {
if (this.testedCityData.length === 0) {
callback(new Error('内容不能为空'))
} else {
callback()
}
}
const validateClient = (rule, value, callback) => {
if (this.formObj.client === '') {
callback(new Error('内容不能为空'))
} else {
callback()
}
}
const validateEdate = (rule, value, callback) => {
if (this.formObj.entrustDate === '') {
callback(new Error('内容不能为空'))
} else {
callback()
}
}
const validateOdate = (rule, value, callback) => {
if (this.formObj.odate === '') {
callback(new Error('内容不能为空'))
} else {
callback()
}
}
return {
formId: 'meterSendTestEditFormId',
getPage: {
records: []
},
showBtn: true,
customerData: [],
cityData: [],
searchOpen: true,
testedCityData: [],
judgeType: [{ value: 1, name: '是' }, { value: 0, name: '否' }],
iconMsg: [
{
type: 'md-trash',
id: 'send-test-meter-send-test-edit-remove-o',
name: '删除'
}
],
pageColumns: [
{ title: '样品名称', key: 'name', width: 200 },
{ title: '型号规格', key: 'spec' },
{ title: '检定/校准依据', key: 'verification', width: 200 },
{ title: '出厂编号', key: 'factoryNumber' },
{ title: '制造单位', key: 'manufacturer' },
{ title: '检测类型', key: 'type' },
{ title: '数量', key: 'quantity' },
{ title: '单价', key: 'price' },
{ title: '总价', key: 'totalPrice' },
{ title: '备注', key: 'remark' }
// {title: '限制范围或说明', key: 'limitDescription'},
],
btn: [
{
type: 'success',
id: 'send-test-meter-send-test-edit-add',
name: '添加'
},
{
type: 'success',
id: 'send-test-meter-send-test-edit-import',
name: '导入'
}
],
options: [
{
name: '检定'
},
{
name: '校准'
},
{
name: '外观检查'
}
],
id: '',
modalTitle: '',
subcontractorId: '',
formObj: {
id: ''
},
ruleValidate: {
client: [
{
required: true,
message: '委托单位不能为空',
validator: validateClient,
trigger: ['blur', 'change']
}
],
entrustDate: [
{
required: true,
validator: validateEdate,
message: '委托日期不能为空',
trigger: 'blur'
}
],
odate: [
{
required: true,
validator: validateOdate,
message: '要求完成时间不能为空',
trigger: 'blur'
}
],
'operation.person': [
{ required: true, message: '联系人不能为空', trigger: 'blur' }
],
'operation.fee': [
{
required: true,
validator: validatefee,
message: '委托费用不能为空',
trigger: 'blur'
}
],
'operation.tel': [
{ required: true, message: '联系电话不能为空', trigger: 'blur' }
],
testedCityData: [
{
required: true,
message: '省市区不能为空',
validator: validateRemark,
trigger: 'blur'
}
]
},
clearingWayList: ['款到后测试', '先测试后付款', '其他情况()'],
clearingWayListTemp: ['款到后测试', '先测试后付款', '其他情况()'],
showModal: false,
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '保存', type: 'primary' }
],
aptitudeData: []
}
},
methods: {
_cusNameChange(msg, data) {
// this.financeObj = {} // 清空维护发票信息的数据
if (this.$string(this.id).isEmpty()) {
// 添加的时候选择单位
switch (msg) {
case 'select':
this._customerMatch(data)
break
case 'query':
this._cusNameQuery(data)
break
}
} else if (this.customerData.indexOf(data) !== -1) {
this._getQueryList(data)
// 编辑的时候选择单位(互不影响)
// this.cusName = data
// this.formObj.customer.cname = data
} else {
}
},
_customerMatch(data) {
this._getQueryList(data)
},
_cusNameQuery(query) {
this.formObj.client = query
},
_btnClick(msg) {
this.$nextTick(function() {
switch (msg) {
case '添加':
this._add()
break
case '导入':
this._importSample()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_inputBack(data) {
console.log(data)
if (undefined !== data) {
if (this.getPage.records.length > 0) {
const j = this.getPage.records.length
for (let i = j; i < data.length + j; i++) {
console.log(i)
this.getPage.records.push(data[i - j])
if (data[i - j].lastTime !== undefined) {
this.getPage.records[i].lastTime = new Date(data[i - j].lastTime)
}
console.log(this.getPage.records)
// this.getPage.records[i].lastTime = new Date(data[0].lastTime)
}
} else {
for (let i = 0; i < data.length; i++) {
// if (this.getPage.records[i].lastTime !== undefined) {
// const t = this.getPage.records[i].lastTime
// const d = t.valueOf(t)
// console.log('时间戳', d)
// this.getPage.records[i].lastTime = d
// this.getPage.records = []
// }
this.getPage.records.push(data[i])
if (data[i].lastTime !== undefined) {
this.getPage.records[i].lastTime = new Date(data[i].lastTime)
}
console.log(data[i].lastTime)
}
}
}
},
_ctimeChange(data) {
console.log('时间', data)
this.formObj.entrustDate = data
},
_odateChange(data) {
this.formObj.odate = data
},
_judgeBasisChange(msg, data) {
switch (msg) {
case 'select':
this.formObj.stdId = data.id
this.formObj.code = data.stdNum
this.formObj.name = data.name
this.$refs.formObj.validateField('code')
break
case 'query':
this.formObj.stdId = ''
this.formObj.code = data.stdNum
this.formObj.name = ''
this._getJudgeBasisList(data.stdNum)
break
case 'focus':
this._getJudgeBasisList()
break
case 'blur':
if (this.formObj.stdId === '') {
this.formObj.code = ''
this._getJudgeBasisList()
}
this.$refs.formObj.validateField('code')
}
},
_selectjudgeBasis(index) {
console.log(index)
this.index = index
this.$refs.EditModal._open()
},
_selectverification(index) {
console.log(index)
this.index = index
this.$refs.VerificationModal._open()
},
_selectcontractCode() {
this.$refs.ContractModal._open()
},
_backData(data) {
this.$forceUpdate()
console.log(typeof this.index)
this.getPage.records[this.index].name = data.name
this.getPage.records[this.index].aptitudeId = data.id
this.getPage.records[this.index].verification = data.code + data.basis
this.getPage.records[this.index].price = data.price
this.getPage.records[this.index].totalPrice =
data.price * this.getPage.records[this.index].quantity
console.log('返回的数据', data)
console.log(this.getPage.records)
},
_backContract(data) {
this.formObj.client = data.client
this.formObj.operation.person = data.person
this.formObj.operation.tel = data.tel
this.formObj.operation.fax = data.fax
if (data.province) {
this.testedCityData = [data.province, data.city, data.county]
this.formObj.province = data.province
this.formObj.city = data.city
this.formObj.county = data.county
}
this.formObj.street = data.street
this.formObj.entrustDate = new Date(data.entrustDate)
this.formObj.odate = new Date(data.odate)
this.formObj.contractCode = data.salesCode
this.formObj.operation.fee = data.discountPrice
if (data.sampleQuoteList) {
this.getPage.records = data.sampleQuoteList
} else {
this.getPage.records = []
}
},
_backVerification(data) {
this.$forceUpdate()
this.getPage.records[this.index].verification = data.verification
},
_add() {
const data = {
name: '',
spec: '',
verification: '',
factoryNumber: '',
quantity: '1',
type: ''
}
this.getPage.records.unshift(data)
},
_importSample() {
const data = {
importUrl: '/meter/v1/sample/import_sample_pre',
downloadUrl: '/meter/v1/excel/template/MeterSampleImport',
title: '导入'
}
this.$refs.importModal._open(data, '样品导入')
},
_tableResultChange(msg, data) {
switch (msg) {
case 'selectIds':
// this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.rowIndex)
break
// case 'changeSize':
// this._page()
// break
}
},
// 省 市 区
_cascaderResult(name, data, msg) {
switch (name) {
case 'cus':
this._casChange(data, msg)
break
case 'tested':
this._testedChange(data, msg)
break
}
},
_emptyProvince() {
this.cityData = []
this.testedCityData = []
// this.formObj.tested.testedProvince = ''
// this.formObj.tested.testedCity = ''
// this.formObj.tested.testedCounty = ''
// this.formObj.testedTemp.testedProvince = ''
// this.formObj.testedTemp.testedCity = ''
// this.formObj.testedTemp.testedCounty = ''
},
_testedChange(data, msg) {
// 省、市、区
if (msg === 'clear') {
// this.formObj.tested.testedProvince = ''
// this.formObj.tested.testedCity = ''
// this.formObj.tested.testedCounty = ''
this.formObj.testedTemp.testedProvince = ''
this.formObj.testedTemp.testedCity = ''
this.formObj.testedTemp.testedCounty = ''
this.formObj.province = ''
this.formObj.city = ''
this.formObj.county = ''
this.testedCityData = []
} else {
// this.formObj.tested.testedProvince = data.value[0]
// this.formObj.tested.testedCity = data.value[1]
// this.formObj.tested.testedCounty = data.value[2]
this.formObj.province = data.value[0]
this.formObj.city = data.value[1]
this.formObj.county = data.value[2]
this.testedCityData = [data.value[0], data.value[1], data.value[2]]
}
},
_iconClick(res, data, index) {
switch (res) {
case '编辑':
// this._editModal(true, data.id)
break
case '删除':
this.getPage.records.splice(index, 1)
this._deleteSample(data)
break
case '操作日志':
// this._record(data.id)
break
}
},
_deleteSample(data) {
if (data.id === undefined) {
return false
} else {
this._delete(data.id)
}
},
_delete: async function(id) {
const result = await meterSample.deleteById(id)
if (result) {
console.log(result)
}
},
_selectAptitude(data) {
console.log(data)
},
_handleRow(data) {
this.currentRow = data.row
this.currentIndex = data.rowIndex
},
channelInputLimit(e) {
const key = e.key
// 不允许输入'e'和'.'
if (key === 'e' || key === '.') {
e.returnValue = false
return false
}
return true
},
/** *modal-footer */
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
}
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_resultChange(msg) {
this.showModal = false
this.$Message.success(msg)
this.$emit('on-result-change')
this._hideLoading()
},
_ok() {
this.$refs.formObj.validate(valid => {
if (valid) {
const data = this.$serialize('MeterSendTestEdit')
Object.assign(this.formObj, data)
if (this.$string(this.id).isEmpty()) {
// 添加
const saveData = this.formObj
this._save(saveData)
} else {
const saveData = this.formObj
this._edit(saveData)
}
} else {
this.$Message.error('表单验证失败!')
this._hideLoading()
}
})
},
_wayResult(msg, data) {
switch (msg) {
case 'select':
this.formObj.clearingWay = data
break
case 'query':
this.formObj.clearingWay = data
this._wayQuery(data)
break
}
},
_wayQuery(query) {
if (query === '') {
this.clearingWayList = this.clearingWayListTemp
} else {
this.clearingWayList = this.clearingWayListTemp.filter(
item => item.indexOf(query) > -1
)
}
},
_cancel() {
this.showModal = false
},
_open(formObj) {
this.showBtn = true
this.showModal = true
this.$refs.formObj.resetFields()
this._hideLoading()
if (this.$string(formObj).isEmpty()) {
this.getPage.records = []
this.id = ''
this.formObj.id = ''
this.formObj.entrustDate = new Date()
this.modalTitle = '委托单新增'
} else {
this.id = formObj.id
this.formObj = formObj
this.modalTitle = '委托单编辑'
this._showTime(formObj)
}
},
_openEdit(formObj) {
this.showBtn = false
this.getPage.records = []
this.showModal = true
this.$refs.formObj.resetFields()
this._hideLoading()
this.id = ''
this.modalTitle = '送检委托单编辑'
this.id = formObj.id
this.formObj = formObj
this._showTime(formObj)
this.getPage.records = formObj.sampleList
for (let i = 0; i < formObj.sampleList.length; i++) {
if (formObj.sampleList[i].lastTime !== undefined) {
this.getPage.records[i].lastTime = new Date(
formObj.sampleList[i].lastTime
)
}
}
},
_showTime(formObj) {
if (this.formObj.odate === undefined) {
this.formObj.odate = ''
} else {
this.formObj.odate = new Date(formObj.odate)
console.log('转换格式后的时间', this.formObj.odate)
}
if (this.formObj.entrustDate === undefined) {
this.formObj.entrustDate = ''
} else {
this.formObj.entrustDate = new Date(formObj.entrustDate)
}
},
_showAddress(formObj) {
this.testedCityData = []
if (
formObj.province !== undefined &&
formObj.city !== undefined &&
formObj.county !== undefined
) {
this.testedCityData.push(formObj.province)
this.testedCityData.push(formObj.city)
this.testedCityData.push(formObj.county)
}
},
_getList: async function() {
const result = await meterEntrust.pageList()
const list = []
console.log('result', result)
if (result) {
for (let i = 0; i < result.length; i++) {
console.log(result[i].cname)
list.push(result[i].cname)
}
console.log('委托单位名单', list)
this.customerData = list
}
},
_getQueryList: async function(data) {
const result = await meterEntrust.pageQueryList(data)
if (result) {
console.log(result)
}
},
_save: async function(data) {
console.log(data)
const result = await meterEntrust.save(data)
console.log(result)
if (result) {
this._resultChange('添加成功!')
}
},
_edit: async function(data) {
const result = await meterEntrust.editDTO(data)
console.log('修改后')
console.log(result)
if (result) {
this._resultChange('编辑成功!')
}
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24" style="margin-top: 10px">
<Form id="formId" v-show="searchOpen" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="委托商:">
<Input v-model="formObj.client" @on-enter="_formSearch" name="client" placeholder="请输入委托单位" clearable/>
</Form-item>
<Form-item class="search-item" label="委托单号:">
<Input v-model="formObj.entrustCode" @on-enter="_formSearch" name="entrustCode" placeholder="请输入委托单号" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" @on-result-change="_btnClick"
class="contHide"></btn-list>
</Col>
<!--表格-->
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
<span v-if="item.key==='edate'">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}
</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<MeterEntrustRecord ref="entrustRecordModal" @on-result-change="_page"></MeterEntrustRecord>
</div>
</template>
<script>
import { soilAptitude } from '../../../api'
import MeterEntrustRecord from '../../../components/operation/Operation'
export default {
components: { MeterEntrustRecord },
data() {
return {
currentComponent: '',
formId: 'meterSubcontractorFormId',
searchOpen: true,
btn: [
// {
// type: 'success',
// id: '',
// name: '添加'
// }
],
iconMsg: [
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
formObj: {
client: undefined,
entrustCode: undefined
},
selectIds: [],
getPage: {},
pageColumns: [
{ title: '委托单位', key: 'client', width: 200 },
{ title: '联系人', key: 'person', width: 120 },
{ title: '委托编号', key: 'entrustCode', width: 120 },
{ title: '联系电话', key: 'tel', width: 120 },
{ title: '传真', key: 'fax', width: 120 },
{ title: '详细地址', key: 'address', width: 250 },
{ title: '邮编', key: 'postcode' },
{ title: 'E-mail', key: 'email', width: 120 },
{ title: '委托日期', key: 'edate', width: 120 },
{ title: '费用合计', key: 'fee', width: 120 },
{ title: '合同号', key: 'contractCode', width: 120 },
{ title: '备注', key: 'remark' }
]
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('search')
} else {
return this.$tableHeight('noSearch')
}
}
},
mounted() {
this._page()
},
methods: {
_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
case '查看样品':
this._sampleManage(data.id)
break
}
})
},
_sampleManage(data) {
// 管理样品
this.$refs.meterSampleManageModal._open(data)
},
_record(id) {
this.$refs.entrustRecordModal._open(id)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilAptitude.page(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
// 删除
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._delete(ids)
}
})
},
// 编辑&添加
_editModal(edit, id) {
if (edit) {
// 编辑
// this.$refs.editSubcontractorModal._open(id)
this._getById(id)
} else {
// 添加
this.$refs.editSubcontractorModal._open()
}
},
// 追加项目
_itemModal(data) {
this.$refs.refModal._open(data)
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
},
_getById: async function(id) {
const result = await soilAptitude.getById(id)
if (result) {
this.$refs.editSubcontractorModal._open(result)
}
},
_delete: async function(ids) {
const result = await soilAptitude.deleteById(ids)
if (result) {
this._formSearch()
this.$Message.success('删除成功!')
}
}
}
}
</script>
......@@ -5,6 +5,7 @@
import workbench from '../pages/workbench/workbench'
import StandardManage from '../pages/meter-aptitude/standard-manage/StandardManage'
import ExperimentItemManage from '../pages/meter-aptitude/item-manage/ExperimentItemManage'
import EntrustIndex from '../pages/meter-entrust/entrust-register/EntrustIndex'
import Blank from '~/pages/blank'
export default [
{
......@@ -18,7 +19,7 @@ export default [
children: [
{
path: 'entrust_register',
component: workbench,
component: EntrustIndex,
meta: { title: '试验委托登记' }
},
{
......
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