Browse Source

addEditFromApiPop组件+mixin中allUrlOption整合开发

noToken
安虹睿 1 year ago
parent
commit
6e03c04a80
  1. 204
      PC/InterFace.Dash/src/components/addEditFromApiPop/index.vue
  2. 888
      PC/InterFace.Dash/src/components/currenFormApi/index.vue
  3. 6
      PC/InterFace.Dash/src/components/filterForDetailPage/index.vue
  4. 20
      PC/InterFace.Dash/src/components/newAndEdiDialog/index.vue
  5. 354
      PC/InterFace.Dash/src/components/newAndEdiDialogForDetail/index.vue
  6. 2
      PC/InterFace.Dash/src/mixins/LoadingMixins.js
  7. 15
      PC/InterFace.Dash/src/mixins/TableHeaderMixins.js
  8. 32
      PC/InterFace.Dash/src/mixins/TableMixins.js
  9. 24
      PC/InterFace.Dash/src/mixins/mixins.js
  10. 5
      PC/InterFace.Dash/src/mixins/newAndEdiDialogMixins.js
  11. 91
      PC/InterFace.Dash/src/store/modules/definition.js
  12. 22
      PC/InterFace.Dash/src/styles/index.scss
  13. 4
      PC/InterFace.Dash/src/utils/index.js
  14. 4
      PC/InterFace.Dash/src/utils/utils.js
  15. 112
      PC/InterFace.Dash/src/views/demo/IncomingData.vue
  16. 3
      PC/InterFace.Dash/src/views/menuList/ExportCustomUserSetting.vue

204
PC/InterFace.Dash/src/components/addEditFromApiPop/index.vue

@ -0,0 +1,204 @@
<template>
<!-- 组件功能普通新增编辑目前只有主表参数配置从api获取 -->
<el-dialog
:visible.sync="show"
:modal="false"
:modal-append-to-body="false"
:show-close="true"
@close="close"
class="searchPageComponents"
:fullscreen="true"
style="width:calc(100% - 28px);left:14px;top:14px;height:calc(100% - 28px)"
>
<!-- 标题 -->
<div class="dialogOuterTitle">{{formTitle}}</div>
<!-- 表单 -->
<el-form
ref="addEditFrom_Ref"
v-if="formData"
:model="formData"
:rules="formRules"
>
<el-row :gutter="40">
<el-col
:span="item.colSpan || 12"
v-for="(item, index) in formItemData"
:key="index"
>
<el-form-item
:label="item.label"
:prop="item.prop"
>
<!-- 数值 -->
<el-input-number
v-if="item.apiBaseType === 'number'"
v-model="formData[item.prop]"
:min="item.minimum || undefined"
:max="item.maximum || undefined"
:maxlength="item.maxLength || undefined"
:minlength="item.minLength || undefined"
:disabled="Boolean(item.disabled)"
:placeholder="item.placeholder || '请输入' + item.label"
@change="changeValue(item.prop,item,$event)"
@clear="clearValue(item.prop,$event)"
></el-input-number>
<!-- 时间转换 -->
<el-date-picker
v-else-if="item.apiBaseType === 'datetime'"
v-model="formData[item.prop]"
type="datetime"
placeholder="选择日期时间"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-ddTHH:mm:ss"
:disabled="Boolean(item.disabled)"
></el-date-picker>
<!-- 布尔枚举 -->
<el-select
v-else-if="item.isEnums || item.apiBaseType === 'boolean'"
v-model="formData[item.prop]"
:placeholder="item.placeholder || '请选择' + item.label"
:disabled="Boolean(item.disabled)"
>
<el-option
v-for="item in getItemEnums(item)"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
<!-- 文本框 -->
<el-input
v-else
v-model="formData[item.prop]"
:placeholder="item.placeholder || '请输入' + item.label"
:disabled="Boolean(item.disabled)"
></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<!-- 操作按钮 -->
<span slot="footer" class="dialog-footer">
<el-button @click="show = false"> </el-button>
<el-button type="primary" @click="submitHandle()"> </el-button>
</span>
</el-dialog>
</template>
<script>
export default {
name:"addEditFromApiPop",
props: {
//
editRowData:{
type: Object,
default: null
},
// add/edit
handleType:{
type: String,
default: null
}
},
data () {
return {
show:true,
formTitle:null,//form
formData:{},//
formItemData:null,//item
formRules: {},//
}
},
mounted(){
this.initTitle()
this.initFormItems()
},
methods: {
// form
initTitle(){
if(this.handleType){
this.formTitle = this.handleType == 'add' ? '新增'+this.$route.name : '编辑'+this.$route.name
}
},
// rules
initFormItems(){
let data = this.$store.getters.dtoColumnTypes
let _dtoList_type = this.handleType == 'add' ? 'C' : 'U'
let _dtoList = data[this.$route.name][_dtoList_type].dtoList
this.formItemData = JSON.parse(JSON.stringify(_dtoList))
//
this.formRules={}
_dtoList.forEach(item=>{
if(item.isRequired){
this.formRules[item.prop] = [{ required: true, trigger: "blur", message: "不可为空" }]
}
})
},
//
getItemEnums(item){
let _option = []
//
if(item.apiBaseType == 'boolean'){
_option = [{
value: true,
label: '是'
},{
value: false,
label: '否'
},]
}
if(item.isEnums){
_option = item.enums_list
}
return _option
},
//
close() {
this.show = false
this.$emit("closePop")
},
//
submitHandle(){
this.$refs.addEditFrom_Ref.validate((valid) => {
if (valid) {
console.log(this.handleType,this.formData)
//
if(this.handleType == 'add'){
}
//
else{
}
this.show = false
} else {
return false;
}
});
},
//
changeValue(prop,item,val) {
this.$emit("changeValue", prop, item, val)
},
//
clearValue(prop,item,val) {
this.$emit("clearValue", prop, item, val)
}
}
}
</script>
<style lang="scss" scoped>
::v-deep .el-dialog__header{
padding: 0 !important;
}
::v-deep .el-form-item__label{
float: unset;
}
::v-deep .el-input,.el-select,.el-input-number{
width: 100% !important;
}
</style>

888
PC/InterFace.Dash/src/components/currenFormApi/index.vue

@ -0,0 +1,888 @@
<template>
<div class="currenForm">
<!-- @submit.native.prevent 阻止form只有一个input输入框回车触发提交事件 -->
<el-form
ref="form"
:size="size"
:label-position="labelPosition"
:inline="inline"
:label-width="labelWidth"
:rules="rules"
:model="searchData"
@submit.native.prevent
v-if="!hide ? true : false"
>
<el-row :gutter="40">
<el-col
:span="item.colSpan"
v-for="(item, index) in searchForm"
:key="index"
>
<el-form-item
:label="item.label"
:prop="item.showProp ? item.prop + '.' + item.showProp : item.prop"
v-if="!item.hide ? true : false"
>
<!-- 输入框 onkeyup: 正则表达式用于前端输入校验工作-->
<!-- :onkeyup="item.onkeyup" -->
<el-input
v-if="item.type === 'input'"
v-model="searchData[item.prop]"
:maxlength="item.maxlength"
:onkeyup="itemOnKeyUp(item,searchData[item.prop])"
clearable
:disabled="Boolean(item.disabled)"
:placeholder="item.placeholder || '请输入' + item.label"
:prefix-icon="item.icon"
:show-password="item.showPassword"
@change="changeInput(item.prop,$event)"
@clear="clearInput(item.prop,$event)"
@blur="
inputPlaceholder($event, item, 'blur',searchData)
"
@focus="inputPlaceholder($event, item, 'focus')"
></el-input>
<!-- 输入框(有上下增加按钮框) onkeyup: 正则表达式用于前端输入校验工作-->
<el-input-number
v-if="item.type === 'number'"
v-model="searchData[item.prop]"
:onkeyup="item.onkeyup"
:disabled="Boolean(item.disabled)"
@change="changeInput(item.prop,$event)"
@clear="clearInput(item.prop,$event)"
:min="item.min"
:max="item.max"
:precision="item.precision"
class="inputNameberClass"
@blur="
inputPlaceholder($event, item, 'blur',searchData)
"
@focus="inputPlaceholder($event, item, 'focus')"
></el-input-number>
<!-- 输入框(只能输入数字) onkeyup: 正则表达式用于前端输入校验工作-->
<!-- oninput="value=value.replace(/[^\d]/g,'')" -->
<el-input
v-if="item.type === 'inputNumber'"
v-model="searchData[item.prop]"
:maxlength="item.maxlength"
:onkeyup="typeNumberOnkeyup(item,searchData[item.prop])"
clearable
:disabled="Boolean(item.disabled)"
:placeholder="item.placeholder || '请输入' + item.label"
:prefix-icon="item.icon"
:show-password="item.showPassword"
@change="changeInput(item.prop,$event)"
@clear="clearInput(item.prop,$event)"
@blur="
inputPlaceholder($event, item, 'blur',searchData)
"
@focus="inputPlaceholder($event, item, 'focus')"
></el-input>
<!-- 对象输入框 -->
<el-input
v-if="item.type === 'objectInput'"
v-model="searchData[item.prop][item.showProp]"
:maxlength="item.maxlength"
clearable
:disabled="Boolean(item.disabled)"
:placeholder="item.placeholder || '请输入' + item.label"
:prefix-icon="item.icon"
:show-password="item.showPassword"
@blur="
inputPlaceholder($event, item, 'blur',searchData)
"
@focus="inputPlaceholder($event, item, 'focus')"
></el-input>
<!-- 对象富文本框 -->
<el-input
v-if="item.type === 'objectTextarea'"
type="textarea"
v-model="searchData[item.prop][item.showProp]"
:placeholder="item.placeholder || '请输入' + item.label"
></el-input>
<!--查询下拉-->
<el-autocomplete
v-if="item.type === 'autocomplete'"
class="inline-input"
style="width: 100%"
v-model="searchData[item.prop]"
:disabled="Boolean(item.disabled)"
:fetch-suggestions="
(queryString, cb) => {
querySearch(queryString, cb, item);
}
"
:placeholder="item.placeholder || '请输入' + item.label"
@select="handleSelect($event, item)"
>
<el-button
slot="append"
icon="el-icon-search"
v-if="item.click"
@click="item.click(item)"
style="color: #1890ff; background-color: #ffffff"
></el-button>
</el-autocomplete>
<!--对象查询下拉-->
<el-autocomplete
v-if="item.type === 'objectAutocomplete'"
class="inline-input"
style="width: 100%"
v-model="searchData[item.prop][item.showProp]"
:fetch-suggestions="
(queryString, cb) => {
querySearch(queryString, cb, item);
}
"
:placeholder="item.placeholder || '请输入' + item.label"
@select="handleSelect($event, item)"
>
<el-button
slot="append"
icon="el-icon-search"
v-if="item.click"
@click="item.click(item)"
style="color: #1890ff; background-color: #ffffff"
></el-button>
</el-autocomplete>
<!-- 文本框 -->
<el-input
v-if="item.type === 'textarea'"
:type="item.type"
v-model="searchData[item.prop]"
:rows="item.rows"
:placeholder="item.placeholder || '请输入' + item.label"
:maxlength="item.maxlength"
show-word-limit
></el-input>
<!-- 下拉框 -->
<el-select
v-if="item.type === 'select'"
v-model="searchData[item.prop]"
:loading="selectLoading"
:clearable="item.clearable"
:multiple="item.multiple"
:disabled="Boolean(item.disabled)"
:filterable="item.filterable"
:allow-create="item.allowCreate"
style="width: 100%"
:placeholder="item.placeholder || '请输入' + item.label"
@change="changeSelect(item.prop,$event)"
>
<el-option
v-for="(op, index) in selectOptions(item.options) ||
item.userOptions"
:label="op[item.optionsLabel] || op.label"
:value="op[item.optionsValue] || op.value"
:key="index"
></el-option>
</el-select>
<!-- 链接接口filter下拉框 -->
<filterSelect
v-if="item.type === 'filterSelect'"
:selectModel="searchData[item.prop]"
:selectItem="item"
@filterOptionSelectHandle="filterOptionSelectHandle"
@filterClearHandle="filterClearHandle(item)"
></filterSelect>
<!--对象下拉框 -->
<el-select
v-if="item.type === 'objectSelect'"
v-model="searchData[item.prop][item.showProp]"
:loading="selectLoading"
:clearable="item.clearable"
:multiple="item.multiple"
:disabled="Boolean(item.disabled)"
:filterable="item.filterable"
:allow-create="item.allowCreate"
style="width: 100%"
:placeholder="item.placeholder || '请输入' + item.label"
>
<el-option
v-for="(op, index) in selectOptions(item.options) ||
searchOptions['options']"
:label="op[item.optionsLabel] || op.label"
:value="op[item.optionsValue] || op.value"
:key="index"
></el-option>
</el-select>
<!-- 下拉框多选 -->
<el-select
v-if="item.type === 'selectArray'"
v-model="searchData[item.prop]"
multiple
:placeholder="item.placeholder || '请选择' + item.label"
style="width: 100%"
>
<el-option
v-for="(op, index) in selectOptions(item.options) ||
item.searchOptions"
:label="op[item.optionsLabel] || op.label"
:value="op[item.optionsValue] || op.value"
:key="index"
></el-option>
</el-select>
<!-- 单选 -->
<el-radio-group
v-if="item.type === 'radio'"
v-model="searchData[item.prop]"
:disabled="Boolean(item.disabled)"
@change="radioChange(item.prop,$event)"
>
<el-radio
v-for="ra in searchOptions[item.radio]"
:label="ra.id"
:key="ra.value"
>{{ ra.label }}</el-radio
>
</el-radio-group>
<!-- 单选按钮 -->
<el-radio-group
v-if="item.type === 'radioButton'"
v-model="searchData[item.prop]"
@change="item.change && item.change(searchData[item.prop])"
>
<el-radio-button
v-for="ra in searchOptions[item.radios]"
:label="ra.value"
:key="ra.value"
>{{ ra.label }}</el-radio-button
>
</el-radio-group>
<!-- 复选框 -->
<el-checkbox v-if="item.type === 'checkbox'" :indeterminate="indeterminate" v-model="item.checkAll" @change="handleCheckAllChange($event,item)">全选</el-checkbox>
<el-checkbox-group
v-if="item.type === 'checkbox'"
v-model="searchData[item.prop]"
@change="handleCheckedCitiesChange($event,item)"
>
<el-checkbox
v-for="ch in searchOptions[item.checkboxs]"
:label="ch"
:key="ch"
>{{ ch }}</el-checkbox
>
</el-checkbox-group>
<!-- 日期 -->
<el-date-picker
v-if="item.type === 'date'"
v-model="searchData[item.prop]"
style="width: 100%"
:disabled="Boolean(item.disabled)"
:placeholder="item.placeholder || '选择日期'"
value-format="yyyy-MM-dd"
></el-date-picker>
<!-- 时间 -->
<el-time-picker
v-if="item.type === 'time'"
v-model="searchData[item.prop]"
:placeholder="item.placeholder || '选择时间'"
style="width: 100%"
:picker-options="{
selectableRange: '00:00:00 - 23:59:00',
}"
:disabled="Boolean(item.disabled)"
format="HH:mm"
value-format="yyyy-MM-ddTHH:mm:ss"
></el-time-picker>
<!-- 日期时间 -->
<el-date-picker
v-if="item.type === 'dateTime'"
type="datetime"
v-model="searchData[item.prop]"
:placeholder="item.placeholder || '选择日期时间'"
style="width: 100%"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-ddTHH:mm:ss"
:disabled="Boolean(item.disabled)"
></el-date-picker>
<!-- 日期时间 日期有限制 选择范围当前天及以后-->
<el-date-picker
v-if="item.type === 'dateTimelimit'"
type="datetime"
v-model="searchData[item.prop]"
:placeholder="item.placeholder || '选择日期时间'"
style="width: 100%"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-ddTHH:mm:ss"
:disabled="Boolean(item.disabled)"
:pickerOptions="endDateTimeLimitPickerOptions()"
></el-date-picker>
<!-- 对象日期时间 -->
<el-date-picker
v-if="item.type === 'objectDateTime'"
type="datetime"
v-model="searchData[item.prop][item.showProp]"
:placeholder="item.placeholder || '选择日期'"
style="width: 100%"
value-format="yyyy-MM-ddTHH:mm:ss"
:disabled="Boolean(item.disabled)"
></el-date-picker>
<!--开始时间结束时间-->
<div
class="RangeDateTime"
v-if="item.type === 'rangeDateTime'"
style="width: 100%; height: 100%"
>
<el-col :span="10">
<el-form-item :prop="item.prop + '.' + item.startDate">
<el-date-picker
type="datetime"
:placeholder="item.placeholder || '开始日期'"
v-model="searchData[item.prop][item.startDate]"
style="width: 100%"
:disabled="Boolean(item.disabled)"
value-format="yyyy-MM-ddTHH:mm:ss"
:pickerOptions="
startPickerOptions(searchData[item.prop][item.endDate])
"
></el-date-picker>
</el-form-item>
</el-col>
<el-col class="line" :span="4">-</el-col>
<el-col :span="10">
<el-form-item :prop="item.prop + '.' + item.endDate">
<el-date-picker
type="datetime"
:placeholder="item.placeholder || '结束日期'"
v-model="searchData[item.prop][item.endDate]"
style="width: 100%"
:disabled="Boolean(item.disabled)"
value-format="yyyy-MM-ddTHH:mm:ss"
:pickerOptions="
endPickerOptions(searchData[item.prop][item.startDate])
"
></el-date-picker>
</el-form-item>
</el-col>
</div>
<!-- 开关 -->
<el-switch
v-if="item.type === 'switch'"
v-model="searchData[item.prop]"
></el-switch>
<!--文件上传-->
<currenUpload
v-if="item.type === 'upload'"
:limit="item.limit"
:beforeUpload="beforeAvatarUpload"
:searchData="searchData[item.prop]"
@httpRequestfiles="httpRequestfiles($event, item.prop)"
@handleRemove="handleRemove($event, item.prop)"
>
</currenUpload>
<!--文件上传列表形式-->
<currenUploadList
v-if="item.type === 'uploadList'"
:limit="item.limit"
:picExt="item.picExt"
:searchData="searchData[item.prop]"
@uploadListView="uploadListView"
@changeUpload="changeUpload($event, item)"
@handleRemove="handleRemove($event, item.prop)"
>
</currenUploadList>
<!-- 缩略图上传 -->
<currenUploadPictureCard
v-if="item.type === 'uploadPictureCard'"
:limit="item.limit"
:multiple="item.multiple"
:picExt="item.picExt"
:searchData="searchData[item.prop]"
@changeUpload="changeUpload($event, item)"
@handleRemove="handleRemove($event, item.prop)"
>
</currenUploadPictureCard>
<el-button
v-if="item.type === 'button'"
type="primary"
size="mini"
@click="item.click(item)"
>
{{item.buttonText}}
</el-button>
</el-form-item>
</el-col>
</el-row>
<slot></slot>
</el-form>
<div v-if="isHandle" class="formButton">
<!-- :style="{float:item.float}" 自定义按钮显示位置 -->
<el-button
v-for="(item, index) in searchHandle"
:key="item.label"
:type="item.type"
:size="item.size || size"
:loading="loading"
:style="{float:item.float}"
@click="submitForm(index,item)"
>{{ item.label }}</el-button
>
</div>
</div>
</template>
<script>
import currenUpload from "@/components/currenUpload";
import currenUploadList from "@/components/currenUploadList";
import currenUploadPictureCard from "@/components/currenUploadPictureCard";
import filterSelect from "@/components/filterSelect"
import { getMatchRegConformValue } from "@/utils/index"
export default {
name: "currenForm",
components: {
currenUpload,
currenUploadList,
currenUploadPictureCard,
filterSelect
},
props: {
loading: {
type: Boolean,
default: false,
},
labelPosition: {
type: String,
default: "right",
},
isHandle: {
type: Boolean,
default: true,
},
inline: {
type: Boolean,
default: false,
},
labelWidth: {
type: String,
default: "140px",
},
size: {
type: String,
default: "mini",
},
searchForm: {
type: Array,
default: () => {
return [];
},
},
searchHandle: {
type: Array,
default: () => {
return [];
},
},
searchData: {
type: Object,
default: () => {
return {};
},
},
searchOptions: {
type: Object,
default: () => {
return {};
},
},
rules: {
type: Object,
default: () => {
return {};
},
},
formSpan: {
type: Number,
default: 24,
},
hide: {
type: Boolean,
default: false,
},
},
data() {
return {
restaurants: [],
indeterminate: false,
selectLoading: false,
};
},
computed: {
startPickerOptions() {
return function (val) {
return {
disabledDate(time) {
if (val) {
return (
// time.getTime() > Date.now() ||
// time.getTime() > new Date(that.CreateFormData.endDate).getTime()
time.getTime() > val
);
}
// return time.getTime() > Date.now(); //1
},
};
};
},
endPickerOptions() {
// const that = this;
return function (val) {
return {
disabledDate(time) {
if (val) {
return (
// time.getTime() > Date.now() ||
// time.getTime() < new Date(that.CreateFormData.startDate).getTime()
time.getTime() < val
);
}
// return time.getTime() > Date.now(); //1
},
};
};
},
//
endDateTimeLimitPickerOptions() {
return function () {
return {
disabledDate(time) {
return (
time.getTime() < Date.now() - 8.64e7
);
},
};
};
},
selectOptions() {
return (val) => {
if (val) {
let options = this.$staticOptions[val];
if (options) {
return options();
} else {
return [];
}
} else {
return false;
}
};
},
},
mounted() {
//
this.searchForm.forEach(item => {
if (item.type === 'radio') {
this.searchData[item.prop] = item.value + ''
}
if (item.type === 'checkbox') {
this.searchData[item.prop].push(item.value)
}
})
},
methods: {
// type=input
itemOnKeyUp(item,value){
if(item.onkeyup){
return item.onkeyup()
}else{
if(value && item.validType){
this.searchData[item.prop]=getMatchRegConformValue(item.validType,value,item.pointNumberFixed)
}
}
},
// inputonkeyup
typeNumberOnkeyup(item,value){
if(value){
// pointNumberFixed
if (item.pointNumberFixed) {
let _fixed = item.pointNumberFixed ? Number(item.pointNumberFixed) : 100
let reg = new RegExp(`\\d+\\.?\\d{0,${_fixed}}`);
let _match = String(value).match(reg)
this.searchData[item.prop] = _match ? _match[0] : _match
} else {
let _match = String(value).match(/\d+/)//
this.searchData[item.prop] = _match?_match[0]:_match
}
}
if(this.searchData[item.prop] > item.max){
this.searchData[item.prop] = item.max
}
if(this.searchData[item.prop] && this.searchData[item.prop] < item.min){
this.searchData[item.prop] = item.min
}
if(item.onkeyup)item.onkeyup()
},
//
handleCheckAllChange(val,item) {
const options = []
if(val){
this.searchOptions[item.checkboxs].forEach(items=>{
options.push(items)
})
}
this.searchData[item.prop] = val ? options : [];
this.indeterminate = false;
},
//
handleCheckedCitiesChange(value,item) {
let checkedCount = value.length;
item.checkAll = checkedCount === this.searchOptions[item.checkboxs].length;
this.indeterminate = checkedCount > 0 && checkedCount < this.searchOptions[item.checkboxs].length;
},
inputPlaceholder(val, item, type, func) {
if (item.valueType) {
if (type == "focus") {
console.log("focus")
//2023-1-3 placeholder
// val.target.placeholder = '0';
// if (val.target.value != "") {
// val.target.placeholder = val.target.value;
// val.target.value = "";
// }
} else if (type == "blur") {
console.log("blur")
// val.target.value = "0"
val.target.value = val.target.value.toString().replace(/[^\d.]/g,'')
// if (val.target.value == "") {
// // if (val.target.placeholder.indexOf('') == -1) {
// val.target.value = val.target.placeholder;
// // }
// }
if(item.showProp){
if(val.target.value != ""){func[item.prop][item.showProp]= Number(val.target.value)}
}else{
if(val.target.value != ""){func[item.prop]= Number(val.target.value)}
}
// item.valueType
// ? (this.searchData[item.prop] = item.valueType(
// this.searchData[item.prop]
// ))
// : () => {
// return;
// }
}
}
},
querySearch(queryString, cb, val) {
const { options, optionsValue, optionsLabel } = val;
let func = val.focus;
let data = {};
if (queryString) {
data.filter = [
{
logic: "And",
column: optionsValue,
action: "Like",
value: queryString,
},
// {
// logic: "Or",
// column: optionsLabel,
// action: "Like",
// value: queryString
// }
];
}
func(data).then((res) => {
var restaurants = this.searchOptions["options"];
var results = queryString
? restaurants.filter(
this.createFilter(queryString, optionsValue, optionsLabel)
)
: restaurants;
results.forEach((key) => {
if (typeof optionsValue === "string") {
key.value = key[optionsValue] + "----" + key[optionsLabel];
} else {
key.value =
key[optionsValue[0]][optionsValue[1]] +
"----" +
key[optionsLabel];
}
});
// callback
cb(results);
});
},
createFilter(queryString, optionsValue, optionsLabel) {
return (restaurant) => {
if (typeof optionsValue === "string") {
restaurant.value =
restaurant[optionsValue] + "----" + restaurant[optionsLabel];
} else {
restaurant.value =
restaurant[optionsValue[0]][optionsValue[1]] +
"----" +
restaurant[optionsLabel];
}
return (
restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) !=
-1
);
};
},
handleSelect(item, val) {
let data = this.searchData;
if (!val.showProp) {
if (typeof val.optionsValue === "string") {
data[val.prop] = item[val.optionsValue];
} else {
data[val.prop] = item[val.optionsValue[0]][val.optionsValue[1]];
}
} else {
if (typeof val.optionsValue === "string") {
data[val.prop][val.showProp] = item[val.optionsValue];
} else {
data[val.prop][val.showProp] =
item[val.optionsValue[0]][val.optionsValue[1]];
}
}
this.$emit("push", item, val);
},
// filterSelectoption
filterOptionSelectHandle(item,props,val){
this.searchData[props['prop']] = val
this.$emit("push", item, props);
},
// filterSelect
filterClearHandle(item){
this.searchData[item['prop']] = ""
this.$emit("clear",item)
},
// selectFocus (val, item) {
// this.selectLoading = true;
// let func = item.focus
// func({}).then(res => {
// this.selectLoading = false;
// })
// },
// dataFilter (query, item) {
// const { options, optionsValue, optionsLabel } = item
// let func = item.focus
// let data = {}
// this.selectLoading = true;
// if (query) {
// data.filter = {
// logic: "And",
// column: optionsLabel,
// action: "Like",
// value: query
// }
// }
// setTimeout(() => {
// func(data).then(res => {
// this.selectLoading = false;
// })
// }, 200);
// // this.options = [];
// },
submitForm(val,item) {
this.$emit("submitForm", val, this.$refs.form,item);
},
getDom(){
return this.$refs.form
},
handleClick(val) {
this.$emit("handleClick", val);
},
httpRequestfiles(val, item) {
this.searchData[item].push(val);
},
beforeAvatarUpload(val, data) {
const repeat = data.filter((item) => {
return item.name == val.name;
});
if (repeat.length != 0) {
this.$errorMsg("文件重复");
return false;
} else {
return true;
}
},
handleRemove(val, item) {
this.searchData[item] = val
},
changeUpload(val, item){
//
let suffix = val.name.substring(val.name.lastIndexOf('.') + 1)
if (item.picExt.indexOf(suffix) === -1) {
this.$warningMsg('上传文件只能是 ' + item.picExt + '格式!')
this.searchData[item.prop] = []
return false
} else {
this.searchData[item.prop].push(val);
}
},
uploadListView() {
this.$emit('uploadListView')
},
radioChange(prop, val) {
this.$emit("radioChange", prop, val)
},
changeInput(prop, val) {
this.$emit("changeInput", prop, val)
},
clearInput(prop, val) {
this.$emit("clearInput", prop, val)
},
changeSelect(prop, val) {
this.$emit("changeSelect", prop, val)
},
restrictionRule(item, prop) {
if(prop) {
console.log('item',item)
console.log('prop', prop)
console.log('this.searchData', this.searchData)
console.log(this.searchData[prop])
if (this.searchData[prop]) {
return false
} else {
return true
}
} else {
return true
}
}
//
// handleExceed (val) {
// this.$warningMsg('1')
// }
// //select
// dataFilter (val, data) {
// if (!data) {
// return;
// } else {
// this.$emit(data, val);
// }
// },
},
};
</script>
<style lang="scss" scoped>
// .formButton {
// text-align: right;
// }
.inputNameberClass {
width: 100%;
}
.el-row {
::v-deep .el-form-item__content {
position: relative;
font-size: 14px;
}
.RangeDateTime {
::v-deep .el-col {
padding: 0 !important;
}
.line {
text-align: center;
}
}
}
::v-deep .el-form-item__label{
color: #999 !important;
font-weight: normal !important;
}
</style>

6
PC/InterFace.Dash/src/components/filterForDetailPage/index.vue

@ -127,7 +127,6 @@ import { LoadingMixins } from "@/mixins/LoadingMixins";
import { mixins } from "@/mixins/mixins"; import { mixins } from "@/mixins/mixins";
import { filterSelectMixins } from '@/mixins/filter-Select' import { filterSelectMixins } from '@/mixins/filter-Select'
import {getListDesById,getPageListForDetail} from "@/api/wms-api" import {getListDesById,getPageListForDetail} from "@/api/wms-api"
import * as allUrlOption from '@/utils/baseData/urlOption'
export default { export default {
name: 'filterForDetailPage', name: 'filterForDetailPage',
mixins: [ mixins: [
@ -203,10 +202,6 @@ export default {
data () { data () {
return { return {
dialogShow:true, dialogShow:true,
URLOption_detailList:allUrlOption[this.$route.name].detailListURL,//-
URLOption_masterId:allUrlOption[this.$route.name].masterId || 'masterId',//-id
URLOption_masterName:allUrlOption[this.$route.name].masterName,//-//-title
URLOption_parent:allUrlOption[this.$route.name].parentURL ? allUrlOption[this.$route.name].parentURL : allUrlOption[this.$route.name].detailURL,//-
currenButtonData: [],// currenButtonData: [],//
operaButtons:[],// operaButtons:[],//
showParentDialog:false,// showParentDialog:false,//
@ -325,6 +320,7 @@ export default {
} }
} }
.el-dialog__body{ .el-dialog__body{
min-height: 200px;
padding-bottom: 20px !important; padding-bottom: 20px !important;
} }
} }

20
PC/InterFace.Dash/src/components/newAndEdiDialog/index.vue

@ -235,26 +235,6 @@ export default {
::v-deep .el-dialog__body{ ::v-deep .el-dialog__body{
padding-top: 0; padding-top: 0;
} }
.dialogOuterTitle{
position: relative;
padding: 20px 0;
font-size: 18px;
height: 60px;
overflow: hidden;
color: #333;
font-weight: bold;
padding-left: 18px;
&::before{
content: "";
position: absolute;
left: 0;
top: 22px;
width: 5px;
height: 22px;
background: #1890ff;
}
}
::v-deep .newAndEdiDialog { ::v-deep .newAndEdiDialog {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

354
PC/InterFace.Dash/src/components/newAndEdiDialogForDetail/index.vue

@ -1,354 +0,0 @@
<template>
<el-dialog
v-loading="loading"
element-loading-text="加载中..."
v-if="displayDialog"
:visible="true"
:fullscreen="true"
:modal="false"
:modal-append-to-body="false"
:show-close="false"
style="width:calc(100% - 28px);left:14px;top:14px;height:calc(100% - 28px)"
>
<div class="dialogOuterTitle">{{formTitle}}</div>
<div v-if="active === 0" class="currentFormAndTable">
<curren-Form
size="medium"
class="newAndEdiDialogForDetail"
:searchData="FormData"
:searchForm="Form"
:searchOptions="Options"
:searchHandle="Handle"
:rules="Rules"
@changeInput="changeInput"
@push="DataPush(arguments)"
@submitForm="FormClick(arguments)"
@radioChange="radioChange"
@changeSelect="changeSelect"
>
<!-- <template>
<div class="addDetailsContent">
<div class="title">添加明细数据</div>
<div class="tableBox">
<currenTableFlex
:flexTableData="flexTableData"
:flexSearchOptions="Options"
:flexTableColumns="flexTableColumns"
:showAddBtn="true"
:showAllDeleteButton="true"
></currenTableFlex>
</div>
</div>
</template> -->
<!-- <template v-if="showmyTable">
<el-form-item class="formTable-box" prop="details">
<currenTable
:tableData="FormData.details"
:tableColumns="myTableColumns"
:selectionTable="selectionTable"
:tableLoading="tableLoading"
:isShowIndex="isShowIndex"
@handleSelectionChange="handleSelectionChange"
>
<template>
<el-table-column
fixed="right"
label="操作"
width="120">
<template slot-scope="scope">
<el-button
@click.native.prevent="deleteRow(scope.$index, FormData.details)"
type="text"
size="small">
删除
</el-button>
</template>
</el-table-column>
</template>
</currenTable>
</el-form-item>
</template> -->
</curren-Form>
<!-- 添加子集数据 -->
<div class="addDetailsContent" v-if="active === 0">
<div class="title">添加明细数据</div>
<currenTableFlex
:flexTableData="flexTableData"
:flexSearchOptions="editOptions"
:flexTableColumns="flexTableColumns"
:showAddBtn="true"
:showAllDeleteButton="true"
></currenTableFlex>
</div>
</div>
<div v-if="active === 1 && pageStatus == 'success'" class="page4">
<el-result icon="success" title="成功提示" :subTitle="formTitle + '成功'">
<template slot="extra">
<el-button type="primary" size="medium" @click="close"
>退出</el-button
>
</template>
</el-result>
</div>
<div v-if="active === 2 && pageStatus == 'error'" class="page4">
<el-result icon="error" title="错误提示" :subTitle="formTitle + '失败'">
<template slot="extra">
<el-button type="primary" size="medium" @click="goBack"
>返回</el-button
>
<el-button type="primary" size="medium" @click="close"
>退出</el-button
>
</template>
</el-result>
</div>
</el-dialog>
</template>
<script>
import currenTableFlex from "@/components/currenTableFlex"
export default {
components: {
currenTableFlex,
},
props: {
loading: {
type: Boolean,
default: false
},
//
active: {
type: Number,
default: 0
},
//active
pageStatus: {
type: String,
default: ""
},
//
formReveal: {
type: Boolean,
},
//dialog
formTitle: {
type: String,
default: ''
},
//dialog
displayDialog: {
type: Boolean,
default: () => {
return false
}
},
//
FormData: {
type: Object,
default: () => {
return {}
}
},
//
Form: {
type: Array,
default: () => {
return []
}
},
//
Options: {
type: Object,
default: () => {
return {}
}
},
//
Handle: {
type: Array,
default: () => {
return []
}
},
//
Rules: {
type: Object,
default: () => {
return {}
}
},
//
myTableColumns: {
type: Array,
default: () => {
return []
}
},
showmyTable: {
type: Boolean,
default: () => {
return false
}
},
selectionTable: {
type: Boolean,
default: () => {
return false
}
},
tableLoading: {
type: Boolean,
default: false
},
isShowIndex: {
type: Boolean,
default: false,
},
// detail
flexTableColumns:{
type: Array,
default: () => {
return []
}
}
},
data () {
return {
session: null,
flexTableData: null,//detail
editOptions: {},
}
},
mounted () {
this.session = JSON.parse(JSON.stringify(this.FormData))
this.flexTableData = this.FormData.details || []
console.log(190,this.flexTableData,this.flexTableColumns)
},
methods: {
//()
FormClick (val) {
if (val[0] == 0) {
this.close()
} else {
val[1].validate((valid) => {
if (valid) {
this.$emit('FormSubmit', val);
} else {
this.$errorMsg('请按照提示继续操作')
return false;
}
});
}
},
close () {
const data = JSON.parse(JSON.stringify(this.session))
this.$emit('close', data)
},
goBack () {
this.$emit('goBack')
},
DataPush (val) {
this.$emit('push', val)
},
deleteRow(index, tableData) {
this.$emit('deleteRow', index, tableData)
},
radioChange(prop,val){
this.$emit('radioChange', prop, val)
},
changeInput(prop, val) {
this.$emit("changeInput", prop, val)
},
//selection
handleSelectionChange(val) {
this.$emit("handleSelectionChange", val);
},
// formchange
changeSelect(prop,val ) {
this.$emit("changeSelect", prop, val)
}
}
}
</script>
<style lang="scss" scoped>
::v-deep .el-dialog__header{
padding: 0 !important;
}
::v-deep .el-dialog__body{
padding-top: 0;
}
.dialogOuterTitle{
position: relative;
padding: 20px 0;
font-size: 18px;
height: 60px;
overflow: hidden;
color: #333;
font-weight: bold;
padding-left: 18px;
&::before{
content: "";
position: absolute;
left: 0;
top: 22px;
width: 5px;
height: 22px;
background: #1890ff;
}
}
.currentFormAndTable{
display: flex;
height: calc(100% - 120px);
}
::v-deep .newAndEdiDialogForDetail {
display: flex;
flex-direction: column;
width: 70%;
height: calc(100% - 10px);
.el-form {
flex: 1;
display: flex;
justify-content: flex-start;
align-content: flex-start;
flex-wrap: wrap;
overflow: hidden;
overflow-y: auto;
padding-right: 40px;
}
.screen-push {
color: rgb(64, 158, 255);
span {
cursor: pointer;
&:hover {
color: blue;
}
}
}
.formButton {
position: fixed;
right: 60px;
bottom: 40px;
}
.formTable-box {
height: 40%;
.el-form-item__content {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
margin: 0 !important;
}
}
}
.addDetailsContent{
background: #f8f8f8;
padding: 20px;
height: calc(100% - 10px);
.currenTableFlex{
height: calc(100% - 20px);
}
}
</style>

2
PC/InterFace.Dash/src/mixins/LoadingMixins.js

@ -21,7 +21,9 @@ export const LoadingMixins = {
importDialog: false, //导入 importDialog: false, //导入
exportDialog: false, //导出 exportDialog: false, //导出
handleFromDialog: false, //执行生成 handleFromDialog: false, //执行生成
// fast-new
detailInfoDialog:false,//明细-查看详情弹窗 detailInfoDialog:false,//明细-查看详情弹窗
addEditApiDialog: false, // Api 新增编辑(参数配置从api获取)
}, },
} }
} }

15
PC/InterFace.Dash/src/mixins/TableHeaderMixins.js

@ -3,12 +3,9 @@ import {
postExport, postExport,
} }
from "@/api/wms-api" from "@/api/wms-api"
import * as allUrlOption from '@/utils/baseData/urlOption'
export const TableHeaderMixins = { export const TableHeaderMixins = {
data() { data() {
return { return {
URLOption_base:allUrlOption[this.$route.name].baseURL,
URLOption_export:allUrlOption[this.$route.name].exportURL,
//筛选(旧版,使用conditionFilters组件) //筛选(旧版,使用conditionFilters组件)
screenData: { screenData: {
filters: [{ filters: [{
@ -32,6 +29,11 @@ export const TableHeaderMixins = {
closeExportDrop(){ closeExportDrop(){
this.displayDialog.exportDialog = false this.displayDialog.exportDialog = false
}, },
// 关闭主表新增编辑api
closeAddEditApiPop(){
this.addEditApiType = null
this.displayDialog.addEditApiDialog = false
},
// 导出功能 // 导出功能
exportDropSubmit(type,form){ exportDropSubmit(type,form){
const name = this.$route.meta.title const name = this.$route.meta.title
@ -62,13 +64,18 @@ export const TableHeaderMixins = {
this.paging() this.paging()
// this.$store.dispatch("app/appMainLoading", true) // this.$store.dispatch("app/appMainLoading", true)
} }
// 新增 // 新增(原始前端写死配置)
else if (val == 'newly') { else if (val == 'newly') {
this.formTitle = "新增" + this.$route.meta.title; this.formTitle = "新增" + this.$route.meta.title;
this.formReveal = true this.formReveal = true
this.theEvent = "newly" this.theEvent = "newly"
this.displayDialog.newDialog = true; this.displayDialog.newDialog = true;
} }
// Api新增(参数配置从api获取)
else if (val == 'addFromApi') {
this.addEditApiType = 'add'
this.displayDialog.addEditApiDialog = true;
}
// 筛选(旧版,使用conditionFilters组件) // 筛选(旧版,使用conditionFilters组件)
// else if (val == 'filter') { // else if (val == 'filter') {
// this.displayDialog.screenDialog = true // this.displayDialog.screenDialog = true

32
PC/InterFace.Dash/src/mixins/TableMixins.js

@ -4,7 +4,6 @@ import {
postDelete postDelete
} from '@/api/wms-api' } from '@/api/wms-api'
import { zhApiColumnsLable,firstWordSizeChange } from '@/utils/index' import { zhApiColumnsLable,firstWordSizeChange } from '@/utils/index'
import * as allUrlOption from '@/utils/baseData/urlOption'
export const tableMixins = { export const tableMixins = {
data() { data() {
return { return {
@ -43,12 +42,6 @@ export const tableMixins = {
apiColumns_DesTions:null, apiColumns_DesTions:null,
apiColumns_DetailsTable:null, apiColumns_DetailsTable:null,
// apiColumns_DetailsPage:null, // apiColumns_DetailsPage:null,
//主表-列表
URLOption_base:allUrlOption[this.$route.name].baseURL,
//主表-明细
URLOption_detail:allUrlOption[this.$route.name].detailURL,
//明细列表(主表明细找枚举转义使用)
URLOption_detailList:allUrlOption[this.$route.name].detailListURL,
// 主表-明细-筛选数据同步回显 // 主表-明细-筛选数据同步回显
detailSearchDataFE:null, detailSearchDataFE:null,
// 主表-操作列 // 主表-操作列
@ -57,16 +50,29 @@ export const tableMixins = {
}, },
methods: { methods: {
// 主表-右侧操作列基础按钮 // 主表-右侧操作列基础按钮
buttonOperationList_rightBase(data){ buttonOperationList_rightBase(){
return [{ return [{
label:'编辑', label:'编辑',
name:'edit', name:'edit',
color:'#ff9000'
},{ },{
label:'删除', label:'删除',
name:'delete', name:'delete',
color:'red' color:'red'
}] }]
}, },
// 主表-右侧操作列基础按钮
buttonOperationList_rightApi(data,type){
let _btns = []
if(type.indexOf('edit') >= 0){
_btns.push({
label:'编辑',
name:'editFromApi',
color:'#ff9000'
})
}
return _btns
},
// 主表-右侧操作列基础按钮操作 // 主表-右侧操作列基础按钮操作
buttonOperationClick_right(row,item){ buttonOperationClick_right(row,item){
// 编辑 // 编辑
@ -82,6 +88,11 @@ export const tableMixins = {
listAssign(this.editFormData, row) listAssign(this.editFormData, row)
this.displayDialog.editDialog = true this.displayDialog.editDialog = true
} }
// 编辑 api
if (item.name == "editFromApi") {
this.addEditApiType = 'edit'
this.displayDialog.addEditApiDialog = true;
}
// 删除 // 删除
else if (item.name == "delete"){ else if (item.name == "delete"){
this.$confirm('此操作将永久删除该消息, 是否继续?', '提示', { this.$confirm('此操作将永久删除该消息, 是否继续?', '提示', {
@ -111,16 +122,13 @@ export const tableMixins = {
if(_coloums){ if(_coloums){
let _data = _coloums.dtoList let _data = _coloums.dtoList
_data.forEach(item=>{ _data.forEach(item=>{
let _item = item
_item.label = zhApiColumnsLable(titleName + item.name) || item.name
_item.prop = firstWordSizeChange(item.name)
// 如果list接口存在数据 ,与list接口返回字段比较处理,list接口存在的话则追加 // 如果list接口存在数据 ,与list接口返回字段比较处理,list接口存在的话则追加
let _if = firstWordSizeChange(item.name) != 'details' let _if = firstWordSizeChange(item.name) != 'details'
if(list && list.length > 0){ if(list && list.length > 0){
_if = firstWordSizeChange(item.name) in list && firstWordSizeChange(item.name) != 'details' _if = firstWordSizeChange(item.name) in list && firstWordSizeChange(item.name) != 'details'
} }
if(_if){ if(_if){
_Columns_Table.push(_item) _Columns_Table.push(item)
} }
}) })
} }

24
PC/InterFace.Dash/src/mixins/mixins.js

@ -6,7 +6,29 @@ import * as allUrlOption from '@/utils/baseData/urlOption'
export const mixins = { export const mixins = {
data() { data() {
return { return {
//主表-列表
URLOption_base:allUrlOption[this.$route.name].baseURL, URLOption_base:allUrlOption[this.$route.name].baseURL,
//主表-明细
URLOption_detail:allUrlOption[this.$route.name].detailURL,
//明细-列表
URLOption_detailList:allUrlOption[this.$route.name].detailListURL,
// 导出
URLOption_export:allUrlOption[this.$route.name].exportURL,
// 新增
URLOption_add:allUrlOption[this.$route.name].addURL,
// 编辑
URLOption_edit:allUrlOption[this.$route.name].editURL,
// 新增和编辑
URLOption_updata:allUrlOption[this.$route.name].updataURL,
//明细-查看主表
URLOption_parent:allUrlOption[this.$route.name].parentURL ? allUrlOption[this.$route.name].parentURL : allUrlOption[this.$route.name].detailURL,
//明细-查看主表的连接id
URLOption_masterId:allUrlOption[this.$route.name].masterId || 'masterId',
//明细-查看主表的连接title名称
URLOption_masterName:allUrlOption[this.$route.name].masterName,
// 列表-明细-查看详情标题名称
URLOption_detailInfoName:allUrlOption[this.$route.name].detailInfoName,
//Dialog标题 //Dialog标题
formTitle: "", formTitle: "",
editOptions: { editOptions: {
@ -43,6 +65,8 @@ export const mixins = {
name: "determine" name: "determine"
}, },
], ],
addEditApiType: null,//Api新增编辑方式(add,edit)
} }
}, },
methods: { methods: {

5
PC/InterFace.Dash/src/mixins/newAndEdiDialogMixins.js

@ -2,14 +2,9 @@ import {
postCreate, postCreate,
postUpdate, postUpdate,
} from "@/api/wms-api" } from "@/api/wms-api"
import * as allUrlOption from '@/utils/baseData/urlOption'
export const newAndEdiDialogMixins = { export const newAndEdiDialogMixins = {
data() { data() {
return { return {
URLOption_base:allUrlOption[this.$route.name].baseURL,
URLOption_updata:allUrlOption[this.$route.name].updataURL,
URLOption_add:allUrlOption[this.$route.name].addURL,
URLOption_edit:allUrlOption[this.$route.name].editURL,
//form数据显示操控 //form数据显示操控
formReveal: true, formReveal: true,
pageStatus: "", pageStatus: "",

91
PC/InterFace.Dash/src/store/modules/definition.js

@ -1,4 +1,5 @@
import { getInterfaceBoard,getApiDefinition } from "@/api/wms-auth" import { getInterfaceBoard,getApiDefinition } from "@/api/wms-auth"
import { zhApiColumnsLable,firstWordSizeChange } from '@/utils/index'
const state = { const state = {
enumList: [],//枚举 enumList: [],//枚举
@ -21,42 +22,26 @@ const mutations = {
}, },
} }
// 通过url做方法处理转换(S/C/U/G等)目前做了S查询。如果有需要在丰富 // 通过url做方法处理转换(S/C/U/G等)目前做了S查询/C新增/U编辑。如果有需要在丰富
export function initDtoTypeByUrl(url){ export function initDtoTypeByUrl(url){
if(url.indexOf('get-list-page-by-filter') >= 0){ if(url.lastIndexOf('/base/get-list-page-by-filter') >= 0){
return "S" return "S"
}else{ }
else if(url.lastIndexOf('/base/create') >= 0){
return "C"
}
else if(url.lastIndexOf('/base/update-by-id') >= 0){
return "U"
}
else{
return url return url
} }
} }
// DTO列类型转义 // dto和枚举转义
export function initDtoColumnTypes(res) { export function initDtoTypesAndEnums(res,typeName,apiName) {
// modules>app>controller>这里是所有的接口
let _controller = res.modules.app.controllers
let _allData = {}
for(let item in _controller){
let _com = 'AppService'
// 获取简单的api(路由,如:IncomingData)
let _api = item.substring(item.lastIndexOf('.') + 1,item.length - _com.length)
let _item = {
S:{
dtoList:[],
dtoType: 'S',
dtoName:item.substring(0,item.length - _com.length),
columnsType:null
}
}
for(let ac in _controller[item].actions){
let _actions = _controller[item].actions[ac]
// actions下通过URL匹配 做特殊处理
// 查询处理
if(initDtoTypeByUrl(_actions.url) == 'S'){
let _type = _actions.returnValue.type
let _type_value = _type.substring(_type.indexOf('<') + 1,_type.indexOf('>'))
_item.S.columnsType=_type_value
// 通过returnValue.type 在 res.types 中获取全部的dto // 通过returnValue.type 在 res.types 中获取全部的dto
let _dtos = res.types[_type_value].properties let _dtos = res.types[typeName].properties
_dtos.forEach(d=>{ _dtos.forEach(d=>{
// 如果是枚举做处理(目前枚举只根据Enums做处理,todo:是否需要其他处理) // 如果是枚举做处理(目前枚举只根据Enums做处理,todo:是否需要其他处理)
if(d.type.indexOf('Enums') >= 0){ if(d.type.indexOf('Enums') >= 0){
@ -83,8 +68,52 @@ export function initDtoColumnTypes(res) {
d.apiBaseType='string' d.apiBaseType='string'
} }
} }
d.baseApiName = apiName + d.name
d.label = zhApiColumnsLable(apiName + d.name,res.types) || d.name
d.prop = firstWordSizeChange(d.name)
}) })
_item.S.dtoList=_dtos return _dtos
}
// DTO列类型转义
export function initDtoColumnTypes(res) {
// modules>app>controller>这里是所有的接口
let _controller = res.modules.app.controllers
let _allData = {}
for(let item in _controller){
let _com = 'AppService'
// 获取简单的api(路由,如:IncomingData)
let _api = item.substring(item.lastIndexOf('.') + 1,item.length - _com.length)
let inner_item = {
baseApi:_api,
dtoList:[],
dtoName:item.substring(0,item.length - _com.length),
columnsType:null
}
let _item = {
S:Object.assign({},inner_item,{dtoType: 'S'}),
C:Object.assign({},inner_item,{dtoType: 'C'}),
U:Object.assign({},inner_item,{dtoType: 'U'}),
}
for(let ac in _controller[item].actions){
let _actions = _controller[item].actions[ac]
// actions下通过URL匹配 做特殊处理
// 查询处理
let _type = _actions.returnValue.type
if(initDtoTypeByUrl(_actions.url) == 'S'){
let _type_value = _type.substring(_type.indexOf('<') + 1,_type.indexOf('>'))
_item.S.columnsType=_type_value
_item.S.dtoList = initDtoTypesAndEnums(res,_type_value,_api)
}
// 新增处理
if( initDtoTypeByUrl(_actions.url) == 'C' ){
_item.C.columnsType = _type
_item.C.dtoList = initDtoTypesAndEnums(res,_type,_api)
}
// 编辑处理
if( initDtoTypeByUrl(_actions.url) == 'U' ){
_item.U.columnsType = _type
_item.U.dtoList = initDtoTypesAndEnums(res,_type,_api)
} }
} }
_allData[_api] = _item _allData[_api] = _item
@ -97,8 +126,8 @@ const actions = {
getDefinitionConfig({ commit }) { getDefinitionConfig({ commit }) {
return new Promise(resolve => { return new Promise(resolve => {
getApiDefinition().then(res=>{ getApiDefinition().then(res=>{
commit('SET_DTOCOLUMN_TYPES', initDtoColumnTypes(res))
commit('SET_ENUM_LIST', res.types) commit('SET_ENUM_LIST', res.types)
commit('SET_DTOCOLUMN_TYPES', initDtoColumnTypes(res))
resolve(res) resolve(res)
}) })
}) })

22
PC/InterFace.Dash/src/styles/index.scss

@ -255,3 +255,25 @@ aside {
background: #f6f7fb !important; background: #f6f7fb !important;
} }
} }
// 弹窗标题
.dialogOuterTitle{
position: relative;
padding: 20px 0;
font-size: 18px;
height: 60px;
overflow: hidden;
color: #333;
font-weight: bold;
padding-left: 18px;
&::before{
content: "";
position: absolute;
left: 0;
top: 22px;
width: 5px;
height: 22px;
background: #1890ff;
}
}

4
PC/InterFace.Dash/src/utils/index.js

@ -413,8 +413,8 @@ export function createNewTabs (url) {
// faster-new // faster-new
// 转义及读取api接口返回的表头信息 // 转义及读取api接口返回的表头信息
export function zhApiColumnsLable (data) { export function zhApiColumnsLable (data,list) {
let _list = store.getters.columZHList let _list = list ? list : store.getters.columZHList
return _list ? _list[data] : data return _list ? _list[data] : data
} }

4
PC/InterFace.Dash/src/utils/utils.js

@ -62,7 +62,7 @@ import searchPage from '@/components/searchPage' //autocomplete拉取数据探
import newAndEdiDialog from '@/components/newAndEdiDialog' //普通新增与编辑 import newAndEdiDialog from '@/components/newAndEdiDialog' //普通新增与编辑
import umyTable from '@/components/umyTable' // 用于数据量过大table import umyTable from '@/components/umyTable' // 用于数据量过大table
import filterForDetailPage from '@/components/filterForDetailPage' //明细查询 import filterForDetailPage from '@/components/filterForDetailPage' //明细查询
import newAndEdiDialogForDetail from '@/components/newAndEdiDialogForDetail' //普通新增与编辑(带明细) import addEditFromApiPop from '@/components/addEditFromApiPop' //新增与编辑(只有主表),参数配置从api获取
// Mixins // Mixins
// import { tableMixins } from "@/mixins/TableMixins" // import { tableMixins } from "@/mixins/TableMixins"
@ -112,9 +112,9 @@ Vue.component('pagination', pagination)
Vue.component('conditionFilters', conditionFilters) Vue.component('conditionFilters', conditionFilters)
Vue.component('searchPage', searchPage) Vue.component('searchPage', searchPage)
Vue.component('newAndEdiDialog', newAndEdiDialog) Vue.component('newAndEdiDialog', newAndEdiDialog)
Vue.component('newAndEdiDialogForDetail', newAndEdiDialogForDetail)
Vue.component('umyTable', umyTable) Vue.component('umyTable', umyTable)
Vue.component('filterForDetailPage', filterForDetailPage) Vue.component('filterForDetailPage', filterForDetailPage)
Vue.component('addEditFromApiPop', addEditFromApiPop)
Vue.prototype.$echarts = eCharts Vue.prototype.$echarts = eCharts
Vue.prototype.$isMobile = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i) Vue.prototype.$isMobile = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
Vue.prototype.$isAndroid = navigator.userAgent.indexOf('Android') > -1 || navigator.userAgent.indexOf('Adr') > -1 Vue.prototype.$isAndroid = navigator.userAgent.indexOf('Android') > -1 || navigator.userAgent.indexOf('Adr') > -1

112
PC/InterFace.Dash/src/views/demo/IncomingData.vue

@ -0,0 +1,112 @@
<template>
<div class="page-box" v-loading="Loading.tableLoading">
<tablePagination
v-if="apiColumns_Table"
:currenButtonData="currenButtonData"
:tableData="tableData"
:tableLoading="Loading.tableLoading"
:tableColumns="apiColumns_Table"
@rowDrop="rowDrop"
:totalCount="totalCount"
:multipleSelection="multipleSelection"
:MaxResultCount="PageListParams.MaxResultCount"
@topbutton="topbutton"
@inlineDialog="inlineDialog"
@sortChange="sortChange"
@alertoldSkipCount="alertoldSkipCount"
@alterResultCount="alterResultCount"
@handleSelectionChange="handleSelectionChange"
:currentPageProps="oldSkipCount"
:quicklySearchOption="quicklySearchOption"
@quicklySearchClick="quicklySearchClick"
@quicklySearchClear="quicklySearchClear"
:primarySearchOption="primarySearchOption"
@overallSearchFormClick="overallSearchFormClick"
:httpOverallSearchData="httpOverallSearchData"
:buttonOperationList_left="buttonOperationClick_leftBase"
@buttonOperationClick_left="buttonOperationClick_left"
:buttonOperationList_right="(data)=>{return buttonOperationList_rightApi(data,'edit')}"
@buttonOperationClick_right="buttonOperationClick_right"
></tablePagination>
<!-- :buttonOperationList_left="buttonOperationClick_leftBase"
@buttonOperationClick_left="buttonOperationClick_left" -->
<curren-Drawer
ref="currenDrawer_Ref"
:title="apiColumns_DesTions"
@rowDrop="rowDrop"
:tableColumns="apiColumns_DetailsTable"
:tabsDesTions="apiColumns_DesTions"
:DrawerLoading="Loading.DrawerLoading"
:drawer="displayDialog.detailsDialog"
:propsData="propsData"
:Butttondata="[]"
@drawerShut="(val) => (displayDialog.detailsDialog = val)"
@drawerbutton="drawerbutton"
@handleCommand="drawerHandle"
@close-value="closeValue"
:totalCount="totalCountDetails"
:currentPage="oldSkipCountDetails"
:MaxResultCount="MaxResultCountDetails"
@alterResultCountDetails="alterResultCountDetails"
@alertoldSkipCountDetails="alertoldSkipCountDetails"
:buttonOperationList_left="operationButtonsDetail"
></curren-Drawer>
<!-- 导出弹窗 -->
<exportDrop
v-if="displayDialog.exportDialog"
@closeDialog="closeExportDrop"
@exportDropSubmit="exportDropSubmit"
></exportDrop>
<!-- Api新增 -->
<addEditFromApiPop
v-if="displayDialog.addEditApiDialog"
:handleType="addEditApiType"
@closePop="closeAddEditApiPop"
></addEditFromApiPop>
</div>
</template>
<script>
import { tableMixins } from "@/mixins/TableMixins";
import { LoadingMixins } from "@/mixins/LoadingMixins";
import { drawerMixins } from "@/mixins/drawerMixins"
import { TableHeaderMixins } from "@/mixins/TableHeaderMixins";
import { mixins } from "@/mixins/mixins";
import { filterSelectMixins } from '@/mixins/filter-Select'
import { getToken } from '@/utils/auth'
export default {
name: "IncomingData",
mixins: [
tableMixins,
LoadingMixins,
drawerMixins,
TableHeaderMixins,
mixins,
filterSelectMixins,
],
data() {
return {
//
currenButtonData: [
this.defaultAddBtn({
name:'addFromApi'
}),//
this.defaultExportBtn({
isRedundance:true,
isDetailExport:true
}),//
this.defaultFieldSettingBtn(),//
this.defaultFreshBtn(),//
this.defaultFilterBtn(),//
],
};
},
mounted() {
this.paging();
},
}
</script>
<style lang="scss" scoped>
@import "@/styles/basicData.scss";
</style>

3
PC/InterFace.Dash/src/views/menuList/ExportCustomUserSetting.vue

@ -215,7 +215,7 @@ export default {
this.paging(); this.paging();
}, },
methods:{ methods:{
pagingCallback(){ pagingCallback(callback){
this.Loading.tableLoading = false this.Loading.tableLoading = false
this.tableData.forEach(item=>{ this.tableData.forEach(item=>{
item.exportTableName_old = item.exportTableName item.exportTableName_old = item.exportTableName
@ -229,6 +229,7 @@ export default {
}) })
item.exportColumnName = _zhArr.join(',') item.exportColumnName = _zhArr.join(',')
}) })
if(callback)callback()
}, },
// / // /
initTablesName(){ initTablesName(){

Loading…
Cancel
Save