|
|
@ -1,73 +1,54 @@ |
|
|
<template> |
|
|
<template> |
|
|
<div class="flex w-100"> |
|
|
<div class="flex w-100"> |
|
|
<div class="flex1 flex"> |
|
|
<div class="flex1 flex"> |
|
|
<el-input v-if="type === 'input'" :maxlength="item.maxlength || 30" :disabled="getDisabled()" |
|
|
|
|
|
:class="item.fillType | getFillType" |
|
|
|
|
|
@blur="onBlur" |
|
|
|
|
|
:placeholder="item.placeholder ? item.placeholder : ('请输入' + item.label)" |
|
|
|
|
|
|
|
|
<el-input v-if="type === 'input'" :maxlength="item.maxlength || 50" :disabled="getDisabled()" |
|
|
|
|
|
:class="item.fillType | getFillType" @blur="onBlur" |
|
|
|
|
|
:placeholder="item.placeholder ? item.placeholder : ('请输入' + item.label)" v-model="inputValue" |
|
|
|
|
|
@input="onInputChange" @change="onInputChange" /> |
|
|
|
|
|
<el-input v-else-if="type === 'textarea'" :maxlength="item.maxlength || 50" :disabled="getDisabled()" |
|
|
|
|
|
:class="item.fillType | getFillType" type="textarea" show-word-limit resize="none" @blur="onBlur" |
|
|
|
|
|
:rows="item.rows || 3" :placeholder="item.placeholder ? item.placeholder : ('请输入' + item.label)" |
|
|
v-model="inputValue" @input="onInputChange" @change="onInputChange" /> |
|
|
v-model="inputValue" @input="onInputChange" @change="onInputChange" /> |
|
|
<el-input v-else-if="type === 'textarea'" :maxlength="item.maxlength || 30" :disabled="getDisabled()" |
|
|
|
|
|
:class="item.fillType | getFillType" |
|
|
|
|
|
type = "textarea" |
|
|
|
|
|
show-word-limit |
|
|
|
|
|
resize = "none" |
|
|
|
|
|
@blur="onBlur" |
|
|
|
|
|
:rows="item.rows || 3" |
|
|
|
|
|
:placeholder="item.placeholder ? item.placeholder : ('请输入' + item.label)" |
|
|
|
|
|
v-model="inputValue" @input="onInputChange" @change="onInputChange" /> |
|
|
|
|
|
<el-input-number v-else-if="type === 'inputNumber'" |
|
|
|
|
|
@blur="onBlur" |
|
|
|
|
|
:maxlength="item.maxlength || 30" |
|
|
|
|
|
class="flex1" |
|
|
|
|
|
:disabled="getDisabled()" |
|
|
|
|
|
:controls = "item.controls || false" |
|
|
|
|
|
:min = "item.min || 0" |
|
|
|
|
|
:precision="item.precision" |
|
|
|
|
|
:class="item.fillType | getFillType" |
|
|
|
|
|
:placeholder="item.placeholder ? item.placeholder : ('请输入' + item.label)" |
|
|
|
|
|
v-model="inputValue" @input="onInputChange" @change="onInputChange" /> |
|
|
|
|
|
<el-select v-else-if="type === 'select'" class="flex1" |
|
|
|
|
|
:multiple = "item.multiple" |
|
|
|
|
|
:class="item.fillType | getFillType" |
|
|
|
|
|
v-model="inputValue" |
|
|
|
|
|
:disabled="getDisabled()" |
|
|
|
|
|
:placeholder="item.placeholder ? item.placeholder : ('请选择' + item.label)" |
|
|
|
|
|
@change = "onInputChange" |
|
|
|
|
|
> |
|
|
|
|
|
<el-option v-for="op in item.options" :key="op.value" :label="op.label" |
|
|
|
|
|
:value="op.value"> |
|
|
|
|
|
|
|
|
<DecimalInput v-else-if="type === 'inputNumber'" @blur="onBlur" :maxlength="item.maxlength || 10" |
|
|
|
|
|
class="flex1" :disabled="getDisabled()" :controls="item.controls || false" :min="item.min || 0" |
|
|
|
|
|
:decimalDigits="item.precision" :class="item.fillType | getFillType" |
|
|
|
|
|
:placeholder="item.placeholder ? item.placeholder : ('请输入' + item.label)" v-model="inputValue" |
|
|
|
|
|
@input="onInputChange" @change="onInputChange" /> |
|
|
|
|
|
<el-select v-else-if="type === 'select'" class="flex1" :multiple="item.multiple" |
|
|
|
|
|
:class="item.fillType | getFillType" v-model="inputValue" :disabled="getDisabled()" |
|
|
|
|
|
:placeholder="item.placeholder ? item.placeholder : ('请选择' + item.label)" @change="onInputChange"> |
|
|
|
|
|
<el-option v-for="op in item.options" :key="op.value" :label="op.label" :value="op.value"> |
|
|
</el-option> |
|
|
</el-option> |
|
|
</el-select> |
|
|
</el-select> |
|
|
<el-date-picker |
|
|
|
|
|
v-else-if="type === 'dateTime'" class="flex1" |
|
|
|
|
|
:class="item.fillType | getFillType" |
|
|
|
|
|
v-model="inputValue" |
|
|
|
|
|
:disabled="getDisabled()" |
|
|
|
|
|
format="yyyy/MM/DD HH:mm:ss" value-format="yyyy/MM/DD HH:mm:ss" |
|
|
|
|
|
:placeholder="item.placeholder ? item.placeholder : ('请选择' + item.label)" |
|
|
|
|
|
@change="onInputChange"> |
|
|
|
|
|
</el-date-picker> |
|
|
|
|
|
|
|
|
<el-date-picker v-else-if="type === 'dateTime'" class="flex1" :class="item.fillType | getFillType" |
|
|
|
|
|
v-model="inputValue" :disabled="getDisabled()" format="yyyy/MM/DD HH:mm:ss" |
|
|
|
|
|
value-format="yyyy/MM/DD HH:mm:ss" |
|
|
|
|
|
:placeholder="item.placeholder ? item.placeholder : ('请选择' + item.label)" @change="onInputChange"> |
|
|
|
|
|
</el-date-picker> |
|
|
</div> |
|
|
</div> |
|
|
<!-- qc才能操作 --> |
|
|
<!-- qc才能操作 --> |
|
|
<div class="handle-row" v-if="isShowHandle()"> |
|
|
<div class="handle-row" v-if="isShowHandle()"> |
|
|
<el-checkbox class = "ml-5"></el-checkbox> |
|
|
|
|
|
<Question class="handle-icon" :class = "getQuestionColor()"/> |
|
|
|
|
|
<img v-if="getIsShowCopyIcon()" @click="onCopy" src="@/assets/images/copy-icon.svg" class="handle-icon" alt=""/> |
|
|
|
|
|
<img src="@/assets/images/record-icon.svg" class="handle-icon" alt=""/> |
|
|
|
|
|
|
|
|
<el-checkbox class="ml-5"></el-checkbox> |
|
|
|
|
|
<Question class="handle-icon" :class="getQuestionColor()" /> |
|
|
|
|
|
<img v-if="getIsShowCopyIcon()" @click="onCopy" src="@/assets/images/copy-icon.svg" class="handle-icon" |
|
|
|
|
|
alt="" /> |
|
|
|
|
|
<img src="@/assets/images/record-icon.svg" class="handle-icon" alt="" /> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import Question from "./icons/Question.vue" |
|
|
|
|
|
|
|
|
import Question from "./icons/Question.vue"; |
|
|
|
|
|
import DecimalInput from "./DecimalInput.vue"; |
|
|
export default { |
|
|
export default { |
|
|
components: { |
|
|
components: { |
|
|
Question |
|
|
|
|
|
|
|
|
Question, |
|
|
|
|
|
DecimalInput |
|
|
}, |
|
|
}, |
|
|
props: { |
|
|
props: { |
|
|
type: {//form类型 input/select等 |
|
|
type: {//form类型 input/select等 |
|
|
type:String, |
|
|
|
|
|
default:"input" |
|
|
|
|
|
|
|
|
type: String, |
|
|
|
|
|
default: "input" |
|
|
}, |
|
|
}, |
|
|
item: { |
|
|
item: { |
|
|
type: Object, |
|
|
type: Object, |
|
|
@ -82,7 +63,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
// v-model 值 |
|
|
// v-model 值 |
|
|
value: { |
|
|
value: { |
|
|
type: [String, Number,Array], |
|
|
|
|
|
|
|
|
type: [String, Number, Array], |
|
|
default: '' |
|
|
default: '' |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
@ -109,7 +90,7 @@ export default { |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
//获取question图标颜色 |
|
|
//获取question图标颜色 |
|
|
getQuestionColor(){ |
|
|
|
|
|
|
|
|
getQuestionColor() { |
|
|
//gray 灰色 green 绿色 orange 橙色 |
|
|
//gray 灰色 green 绿色 orange 橙色 |
|
|
return "green" |
|
|
return "green" |
|
|
}, |
|
|
}, |
|
|
@ -120,31 +101,31 @@ export default { |
|
|
this.$emit('change', value); |
|
|
this.$emit('change', value); |
|
|
}, |
|
|
}, |
|
|
//判断是否显示复制按钮 |
|
|
//判断是否显示复制按钮 |
|
|
getIsShowCopyIcon(){ |
|
|
|
|
|
const {copyFrom} = this.item; |
|
|
|
|
|
const {templateStatus} = this.$store.state.template; |
|
|
|
|
|
return copyFrom && templateStatus=== "actFill"; |
|
|
|
|
|
|
|
|
getIsShowCopyIcon() { |
|
|
|
|
|
const { copyFrom } = this.item; |
|
|
|
|
|
const { templateStatus } = this.$store.state.template; |
|
|
|
|
|
return copyFrom && templateStatus === "actFill"; |
|
|
}, |
|
|
}, |
|
|
//判断是否显示操作按钮 |
|
|
//判断是否显示操作按钮 |
|
|
isShowHandle(){ |
|
|
|
|
|
const {fillType} = this.item; |
|
|
|
|
|
const {templateStatus} = this.$store.state.template; |
|
|
|
|
|
|
|
|
isShowHandle() { |
|
|
|
|
|
const { fillType } = this.item; |
|
|
|
|
|
const { templateStatus } = this.$store.state.template; |
|
|
//只有当模板状态是qc和实际填报时,才显示操作按钮 |
|
|
//只有当模板状态是qc和实际填报时,才显示操作按钮 |
|
|
return (templateStatus === "qc" || templateStatus === "actFill")&&fillType === "actFill"; |
|
|
|
|
|
|
|
|
return (templateStatus === "qc" || templateStatus === "actFill") && fillType === "actFill"; |
|
|
}, |
|
|
}, |
|
|
//判断是否禁用 |
|
|
//判断是否禁用 |
|
|
getDisabled(){ |
|
|
|
|
|
const {item} = this; |
|
|
|
|
|
const {fillType} = item; |
|
|
|
|
|
if(item.hasOwnProperty("disabled")){ |
|
|
|
|
|
|
|
|
getDisabled() { |
|
|
|
|
|
const { item } = this; |
|
|
|
|
|
const { fillType } = item; |
|
|
|
|
|
if (item.hasOwnProperty("disabled")) { |
|
|
return item.disabled |
|
|
return item.disabled |
|
|
}else{ |
|
|
|
|
|
const {templateStatus} = this.$store.state.template; |
|
|
|
|
|
if(fillType === "actFill"){//当模板状态是实际填写时,只有当fillType是actFill时才能填写 |
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
const { templateStatus } = this.$store.state.template; |
|
|
|
|
|
if (fillType === "actFill") {//当模板状态是实际填写时,只有当fillType是actFill时才能填写 |
|
|
return templateStatus !== "actFill" |
|
|
return templateStatus !== "actFill" |
|
|
}else if(fillType === "preFill"){//当模板状态是预填写时,只有当fillType是preFill才能填写 |
|
|
|
|
|
|
|
|
} else if (fillType === "preFill") {//当模板状态是预填写时,只有当fillType是preFill才能填写 |
|
|
return templateStatus !== "preFill" |
|
|
return templateStatus !== "preFill" |
|
|
}else{ |
|
|
|
|
|
|
|
|
} else { |
|
|
return true |
|
|
return true |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -152,8 +133,8 @@ export default { |
|
|
onCopy() { |
|
|
onCopy() { |
|
|
this.$emit("copy") |
|
|
this.$emit("copy") |
|
|
}, |
|
|
}, |
|
|
onBlur(val){ |
|
|
|
|
|
this.$emit("blur",val) |
|
|
|
|
|
|
|
|
onBlur(val) { |
|
|
|
|
|
this.$emit("blur", val) |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
} |
|
|
} |
|
|
@ -175,28 +156,37 @@ export default { |
|
|
align-items: center; |
|
|
align-items: center; |
|
|
cursor: pointer; |
|
|
cursor: pointer; |
|
|
} |
|
|
} |
|
|
.w-100{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.w-100 { |
|
|
width: 100%; |
|
|
width: 100%; |
|
|
} |
|
|
} |
|
|
.handle-icon{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.handle-icon { |
|
|
width: 18px; |
|
|
width: 18px; |
|
|
height: 18px; |
|
|
height: 18px; |
|
|
margin-left: 5px; |
|
|
margin-left: 5px; |
|
|
} |
|
|
} |
|
|
.ml-5{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.ml-5 { |
|
|
margin-left: 5px; |
|
|
margin-left: 5px; |
|
|
} |
|
|
} |
|
|
.orange{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.orange { |
|
|
color: #f9c588; |
|
|
color: #f9c588; |
|
|
} |
|
|
} |
|
|
.green{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.green { |
|
|
color: green; |
|
|
color: green; |
|
|
} |
|
|
} |
|
|
.gray{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.gray { |
|
|
color: #b2b2b2; |
|
|
color: #b2b2b2; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.orange-border { |
|
|
.orange-border { |
|
|
input, textarea { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
input, |
|
|
|
|
|
textarea { |
|
|
border-color: #f9c588; |
|
|
border-color: #f9c588; |
|
|
|
|
|
|
|
|
&:focus { |
|
|
&:focus { |
|
|
@ -206,6 +196,7 @@ export default { |
|
|
&:hover { |
|
|
&:hover { |
|
|
border-color: #f9c588; |
|
|
border-color: #f9c588; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
&:disabled { |
|
|
&:disabled { |
|
|
border-color: #f9c588 !important; |
|
|
border-color: #f9c588 !important; |
|
|
} |
|
|
} |
|
|
@ -214,7 +205,9 @@ export default { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.green-border { |
|
|
.green-border { |
|
|
input, textarea { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
input, |
|
|
|
|
|
textarea { |
|
|
border-color: green; |
|
|
border-color: green; |
|
|
|
|
|
|
|
|
&:focus { |
|
|
&:focus { |
|
|
@ -224,6 +217,7 @@ export default { |
|
|
&:hover { |
|
|
&:hover { |
|
|
border-color: green; |
|
|
border-color: green; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
&:disabled { |
|
|
&:disabled { |
|
|
border-color: green !important; |
|
|
border-color: green !important; |
|
|
} |
|
|
} |
|
|
@ -232,7 +226,9 @@ export default { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.blue-border { |
|
|
.blue-border { |
|
|
input, textarea { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
input, |
|
|
|
|
|
textarea { |
|
|
border-color: #4ea2ff; |
|
|
border-color: #4ea2ff; |
|
|
|
|
|
|
|
|
&:focus { |
|
|
&:focus { |
|
|
@ -242,6 +238,7 @@ export default { |
|
|
&:hover { |
|
|
&:hover { |
|
|
border-color: #4ea2ff; |
|
|
border-color: #4ea2ff; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
&:disabled { |
|
|
&:disabled { |
|
|
border-color: #4ea2ff !important; |
|
|
border-color: #4ea2ff !important; |
|
|
} |
|
|
} |
|
|
|