Browse Source

feat:[模板管理][组件提取ing]

luojie
luojie 1 week ago
parent
commit
25c3cd6ecc
5 changed files with 76 additions and 7 deletions
  1. +38
    -6
      src/components/Template/HandleFormItem.vue
  2. +3
    -1
      src/store/index.js
  3. +17
    -0
      src/store/modules/template.js
  4. +2
    -0
      src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue
  5. +16
    -0
      src/views/business/comps/template/mixins/templateMixin.js

+ 38
- 6
src/components/Template/HandleFormItem.vue View File

@ -1,7 +1,7 @@
<template>
<div class="flex w-100">
<div class="flex1 flex">
<el-input v-if="type === 'input'" :maxlength="item.maxlength || 30" :disabled="item.disabled"
<el-input v-if="type === 'input'" :maxlength="item.maxlength || 30" :disabled="getDisabled()"
:class="item.fillType | getFillType"
:placeholder="item.placeholder ? item.placeholder : ('请输入' + item.label)"
v-model="inputValue" />
@ -9,6 +9,7 @@
:multiple = "item.multiple"
:class="item.fillType | getFillType"
v-model="inputValue"
:disabled="getDisabled()"
:placeholder="item.placeholder ? item.placeholder : ('请选择' + item.label)"
@change = "onSelectChange"
>
@ -20,11 +21,13 @@
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)">
</el-date-picker>
</div>
<div class="handle-row">
<!-- qc才能操作 -->
<div class="handle-row" v-if="isShowHandle()">
<i class="el-icon-question"></i>
<el-checkbox></el-checkbox>
<span @click="onCopy">复制</span>
@ -40,10 +43,6 @@ export default {
type:String,
default:"input"
},
fillType: {
type: String,
default: ""
},
item: {
type: Object,
default: () => {
@ -91,6 +90,30 @@ export default {
},
methods: {
//
isShowHandle(){
const {fillType} = this.item;
const {templateStatus} = this.$store.state.template;
//qc
return (templateStatus === "qc" || templateStatus === "actFill")&&fillType === "actFill";
},
//
getDisabled(){
const {item} = this;
const {fillType} = item;
if(item.hasOwnProperty("disabled")){
return item.disabled
}else{
const {templateStatus} = this.$store.state.template;
if(fillType === "actFill"){//fillTypeactFill
return templateStatus !== "actFill"
}else if(fillType === "preFill"){//fillTypepreFill
return templateStatus !== "preFill"
}else{
return true
}
}
},
onCopy() {
this.$emit("copy")
},
@ -132,6 +155,9 @@ export default {
&:hover {
border-color: #f9c588;
}
&:disabled {
border-color: #f9c588 !important;
}
}
}
@ -147,6 +173,9 @@ export default {
&:hover {
border-color: green;
}
&:disabled {
border-color: green !important;
}
}
}
@ -162,6 +191,9 @@ export default {
&:hover {
border-color: #4ea2ff;
}
&:disabled {
border-color: #4ea2ff !important;
}
}
}

+ 3
- 1
src/store/index.js View File

@ -7,6 +7,7 @@ import tagsView from './modules/tagsView'
import permission from './modules/permission'
import settings from './modules/settings'
import getters from './getters'
import template from './modules/template'
Vue.use(Vuex)
@ -17,7 +18,8 @@ const store = new Vuex.Store({
user,
tagsView,
permission,
settings
settings,
template
},
getters
})

+ 17
- 0
src/store/modules/template.js View File

@ -0,0 +1,17 @@
const template = {
namespaced: true,
state: {
templateStatus:"",//模板状态 "actFill" 实际填报 "preFill" 预填 ”qc“
},
mutations: {
SET_TEMPLATE_STATUS: (state, status) => {
state.templateStatus = status
}
},
actions: {
setTemplateStatus({ commit }, status) {
commit('SET_TEMPLATE_STATUS', status)
}
}
}
export default template

+ 2
- 0
src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue View File

@ -30,9 +30,11 @@ import BaseInfoFormPcakge from "@/components/Template/BaseInfoFormPcakge";
import LineLabel from "@/components/Template/LineLabel";
import TableList from "@/components/Template/Table";
import Step from "@/components/Template/Step";
import templateMixin from "../../mixins/templateMixin";
export default {
name: "SWYPFXRYPZB",
components: { BaseInfoFormPcakge,LineLabel,TableList,Step },
mixins: [templateMixin],
props: {
value: {
type: {},

+ 16
- 0
src/views/business/comps/template/mixins/templateMixin.js View File

@ -0,0 +1,16 @@
export default {
data() {
},
mounted() {
setTimeout(() => {
this.setTemplateStatus("actFill")
}, 4000)
},
methods: {
setTemplateStatus(status) {
this.$store.commit('template/SET_TEMPLATE_STATUS', status)
}
},
}

Loading…
Cancel
Save