Commit 22065a4e authored by daywrite's avatar daywrite

费用报销新建

parent 1b759ef8
......@@ -48,6 +48,11 @@ export default {
reimbursementCarbonCopyRels () {
let ret = this.getArrayByKey('Reimbursements', 'form_reimbursementCarbonCopyRels')
return ret && [].concat(ret.value)
},
reimbursementSettleAccountsAt () {
let ret = this.getArrayByKey('Reimbursements', 'settle_accounts_at')
return ret && [].concat(ret.value)
}
},
......
......@@ -8,11 +8,11 @@
@update:item="val => {model.form_type = val}">
</single-radio>
</el-form-item>
<el-form-item label="费用类型:" prop="cost_type" class="ec-clear-left is-required">
<el-form-item label="费用类型:" prop="form_costType" class="ec-clear-left is-required">
<single-radio
:form-item="model.cost_type"
:form-item="model.form_costType"
:options-list="reimCostTypeArray"
@update:item="val => {model.cost_type = val}">
@update:item="val => {model.form_costType = val}">
</single-radio>
</el-form-item>
<el-form-item label="发生时间:" prop="occurrence_at" class="ec-clear-left is-required">
......@@ -23,6 +23,14 @@
placeholder="选择日期时间">
</el-date-picker>
</el-form-item>
<el-form-item label="结算时间:" prop="settle_accounts_at" class="ec-clear-left is-required">
<el-date-picker
size="small"
v-model="model.settle_accounts_at"
type="datetime"
placeholder="选择日期时间">
</el-date-picker>
</el-form-item>
<el-form-item label="费用金额:" prop="amount" class="ec-clear-left ec-form-item-lg is-required">
<el-input
class="ec-input-normal"
......@@ -54,21 +62,23 @@
</el-select>
</el-form-item>
<el-form-item label="审核人:" prop="form_reimbursementVerifyRels" class="ec-clear-left ec-form-item-lg is-required">
<el-select v-model="model.form_reimbursementVerifyRels" size="small" multiple placeholder="请选择">
<el-select v-model="model.form_reimbursementVerifyRels" size="small" multiple placeholder="点击选择或输入关键字查询">
<el-option v-for="(option, optKey) in reimbursementVerifyRels"
:key="optKey"
:label="option.name"
:value="option.key"></el-option>
</el-select>
</el-form-item>
<el-form-item label="结算人:" prop="actName" class="ec-clear-left is-required">
<settle-account-select
:query="model"
:inputWidth="340"
:startLoadInitial="false"/>
<el-form-item label="结算人:" prop="settle_accounts_by" class="ec-clear-left is-required">
<el-select v-model="model.settle_accounts_by" size="small" filterable placeholder="点击选择或输入关键字查询">
<el-option v-for="(option, optKey) in reimbursementSettleAccountsAt"
:key="optKey"
:label="option.name"
:value="option.key"></el-option>
</el-select>
</el-form-item>
<el-form-item label="抄送:" prop="form_reimbursementCarbonCopyRels" class="ec-clear-left ec-form-item-lg">
<el-select v-model="model.form_reimbursementCarbonCopyRels" size="small" multiple placeholder="请选择">
<el-select v-model="model.form_reimbursementCarbonCopyRels" size="small" multiple placeholder="点击选择或输入关键字查询">
<el-option v-for="(option, optKey) in reimbursementCarbonCopyRels"
:key="optKey"
:label="option.name"
......@@ -87,7 +97,6 @@
</section>
</template>
<script>
import settleAccountSelect from './settleAccountSelect'
import singleRadio from '../common/singleRadio'
import settingMixin from '../common/settingMixin'
import depSelect from '../schedule/depSelect'
......@@ -105,7 +114,6 @@ export default {
},
components: {
settleAccountSelect,
singleRadio,
depSelect
},
......
......@@ -30,8 +30,9 @@ export default {
diaVis: false,
model: {
form_type: '',
cost_type: '',
form_costType: '',
occurrence_at: '',
settle_accounts_at: '',
amount: '',
client_id: '',
client_name: '', // 客户
......@@ -52,8 +53,8 @@ export default {
handleClose () {
Object.keys(this.model).forEach(item => {
if (Array.isArray(item)) {
this.model[item] = ''
if (item === 'form_reimbursementVerifyRels' || item === 'form_reimbursementCarbonCopyRels') {
this.model[item] = []
} else {
this.model[item] = ''
}
......@@ -62,10 +63,10 @@ export default {
},
save () {
console.log(this.model)
let _params = Object.assign({}, setModule(this.model, 'Reimbursements'))
let _apiUrl = !this.model.id ? api.saveNewReim : api.saveEditReim
!this.model.id && delete _params['Reimbursements[id]']
console.log(_params)
requestAPI(Object.assign(_apiUrl, { method: 'POST' }), _params)
.then((res) => {
this.$refs.scheduleSidePopup.close()
......
......@@ -24,14 +24,9 @@ export function removeEmptyMemberArray (arr) {
export let setModule = (obj, key) => {
let ob = {}
Object.keys(obj).forEach((item) => {
// ob[key + '[' + item + ']'] = obj[item]
if (Array.isArray(obj[item])) {
obj[item].forEach(arr => {
if (arr.key === 'new') {
ob[key + '[' + item + '][' + arr.key + '][]'] = arr.name
} else {
ob[key + '[' + item + '][' + arr.key + ']'] = arr.name
}
})
ob[key + '[' + item + ']'] = obj[item]
} else {
ob[key + '[' + item + ']'] = obj[item]
}
......
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