|
@@ -44,12 +44,158 @@
|
|
|
<el-option v-for="(item, index) in process" :key="index" :label="item.name" :value="item.id" />
|
|
|
</el-select>
|
|
|
</div>
|
|
|
+
|
|
|
+ <div class="panelRow">
|
|
|
+ <div>模板关联字段:</div>
|
|
|
+ <el-row style="width: 90%">
|
|
|
+ <el-col :span="7">公司名称</el-col>
|
|
|
+ <el-col :span="17">
|
|
|
+ <el-select
|
|
|
+ v-model="contract.organName"
|
|
|
+ size="small"
|
|
|
+ style="width:100%; font-size:12px"
|
|
|
+ placeholder="选择公司名称"
|
|
|
+ :disabled="readOnly"
|
|
|
+ clearable
|
|
|
+ :filterable="true"
|
|
|
+ @change="onChangeSelectContract"
|
|
|
+ >
|
|
|
+ <el-option-group
|
|
|
+ v-for="group in fieldList"
|
|
|
+ :key="group.label"
|
|
|
+ :label="group.label"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="i in group.options"
|
|
|
+ :key="i.value"
|
|
|
+ :label="i.label"
|
|
|
+ :value="i.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-option-group>
|
|
|
+ </el-select>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="7">费用类型</el-col>
|
|
|
+ <el-col :span="17">
|
|
|
+ <el-select
|
|
|
+ v-model="contract.feeType"
|
|
|
+ size="small"
|
|
|
+ style="width:100%; font-size:12px"
|
|
|
+ placeholder="选择费用类型"
|
|
|
+ :disabled="readOnly"
|
|
|
+ clearable
|
|
|
+ :filterable="true"
|
|
|
+ @change="onChangeSelectContract"
|
|
|
+ >
|
|
|
+ <el-option-group
|
|
|
+ v-for="group in fieldList"
|
|
|
+ :key="group.label"
|
|
|
+ :label="group.label"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="i in group.options"
|
|
|
+ :key="i.value"
|
|
|
+ :label="i.label"
|
|
|
+ :value="i.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-option-group>
|
|
|
+ </el-select>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="7">报销金额</el-col>
|
|
|
+ <el-col :span="17">
|
|
|
+ <el-select
|
|
|
+ v-model="contract.totalMoney"
|
|
|
+ size="small"
|
|
|
+ style="width:100%; font-size:12px"
|
|
|
+ placeholder="选择报销金额"
|
|
|
+ :disabled="readOnly"
|
|
|
+ clearable
|
|
|
+ :filterable="true"
|
|
|
+ @change="onChangeSelectContract"
|
|
|
+ >
|
|
|
+ <el-option-group
|
|
|
+ v-for="group in fieldList"
|
|
|
+ :key="group.label"
|
|
|
+ :label="group.label"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="i in group.options"
|
|
|
+ :key="i.value"
|
|
|
+ :label="i.label"
|
|
|
+ :value="i.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-option-group>
|
|
|
+ </el-select>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="7">是否有借款</el-col>
|
|
|
+ <el-col :span="17">
|
|
|
+ <el-select
|
|
|
+ v-model="contract.hasLoan"
|
|
|
+ size="small"
|
|
|
+ style="width:100%; font-size:12px"
|
|
|
+ placeholder="选择是否有借款"
|
|
|
+ :disabled="readOnly"
|
|
|
+ clearable
|
|
|
+ :filterable="true"
|
|
|
+ @change="onChangeSelectContract"
|
|
|
+ >
|
|
|
+ <el-option-group
|
|
|
+ v-for="group in fieldList"
|
|
|
+ :key="group.label"
|
|
|
+ :label="group.label"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="i in group.options"
|
|
|
+ :key="i.value"
|
|
|
+ :label="i.label"
|
|
|
+ :value="i.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-option-group>
|
|
|
+ </el-select>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <el-col :span="7">情况说明</el-col>
|
|
|
+ <el-col :span="17">
|
|
|
+ <el-select
|
|
|
+ v-model="contract.memo"
|
|
|
+ size="small"
|
|
|
+ style="width:100%; font-size:12px"
|
|
|
+ placeholder="选择情况说明"
|
|
|
+ :disabled="readOnly"
|
|
|
+ clearable
|
|
|
+ :filterable="true"
|
|
|
+ @change="onChangeSelectContract"
|
|
|
+ >
|
|
|
+ <el-option-group
|
|
|
+ v-for="group in fieldList"
|
|
|
+ :key="group.label"
|
|
|
+ :label="group.label"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="i in group.options"
|
|
|
+ :key="i.value"
|
|
|
+ :label="i.label"
|
|
|
+ :value="i.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-option-group>
|
|
|
+ </el-select>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import DefaultDetail from './DefaultDetail'
|
|
|
import NodeDetail from './NodeDetail'
|
|
|
+import { templateDetails } from '@/api/process/admin/template'
|
|
|
export default {
|
|
|
inject: ['i18n'],
|
|
|
components: {
|
|
@@ -85,6 +231,83 @@ export default {
|
|
|
type: Array,
|
|
|
default: () => ([])
|
|
|
}
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ fieldList: [],
|
|
|
+ contract: {
|
|
|
+ organName: '',
|
|
|
+ feeType: '',
|
|
|
+ hasLoan: '',
|
|
|
+ totalMoney: '',
|
|
|
+ memo: ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async mounted() {
|
|
|
+ await this.__init()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async __init() {
|
|
|
+ const templateList = []
|
|
|
+ this.templates.forEach((item) => {
|
|
|
+ templateList.push(this.getFieldList(item))
|
|
|
+ })
|
|
|
+
|
|
|
+ Promise.all(templateList).then(values => {
|
|
|
+ this.formatTemplateData(values)
|
|
|
+ // 反显数据
|
|
|
+ let conditionExpression = this.model.conditionExpression
|
|
|
+ conditionExpression = conditionExpression ? JSON.parse(conditionExpression) : null
|
|
|
+ if (conditionExpression) {
|
|
|
+ this.conditionList = conditionExpression
|
|
|
+ this.onFormatField()
|
|
|
+ this.$forceUpdate()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onFormatField() {
|
|
|
+ this.conditionList.forEach((con, index) => {
|
|
|
+ this.fieldType[index] = this.onFormatType(con.key)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async getFieldList(id) {
|
|
|
+ return new Promise(async(resolve, reject) => {
|
|
|
+ await templateDetails({ template_id: id }).then(res => {
|
|
|
+ resolve(res.data)
|
|
|
+ }).catch(() => {
|
|
|
+ reject()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ formatTemplateData(template) {
|
|
|
+ this.fieldList = []
|
|
|
+ const templates = template || []
|
|
|
+ const optionList = []
|
|
|
+ templates.forEach(template => {
|
|
|
+ const options = {}
|
|
|
+ options.label = template.name
|
|
|
+ options.options = []
|
|
|
+ const formStructure = template.form_structure.list || []
|
|
|
+ if (formStructure.length > 0) {
|
|
|
+ formStructure.forEach(item => {
|
|
|
+ if (item.type != 'subform') {
|
|
|
+ options.options.push({
|
|
|
+ label: item.name,
|
|
|
+ type: item.type,
|
|
|
+ value: item.model,
|
|
|
+ options: item.options.options || []
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ optionList.push(options)
|
|
|
+ })
|
|
|
+ this.fieldList = optionList
|
|
|
+ },
|
|
|
+ onChangeSelectContract() {
|
|
|
+ this.onChange('contract', JSON.stringify(this.contract))
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|