Browse Source

Merge branch 'qin_v21'

han_v1
herenshan112 7 months ago
parent
commit
bd5183dc0e
  1. 1
      src/components/DesignForm/public/form/formItem.vue
  2. 453
      src/views/matrix/matrixcont/setupmatrixuser.vue
  3. 1087
      src/views/matrix/orgoruser/pickorg.vue

1
src/components/DesignForm/public/form/formItem.vue

@ -1241,6 +1241,7 @@ const diGuiJilian = (val: any, options: any[]) => {
v-model="value" v-model="value"
:disabled="judgeIsDisabled(data.name)" :disabled="judgeIsDisabled(data.name)"
type="textarea" type="textarea"
:autosize="{ minRows: 2, maxRows: 20 }"
:placeholder=" :placeholder="
data.control.placeholder data.control.placeholder
? data.control.placeholder ? data.control.placeholder

453
src/views/matrix/matrixcont/setupmatrixuser.vue

@ -3,263 +3,286 @@
@ 时间: 2023-07-05 15:03:42 @ 时间: 2023-07-05 15:03:42
@ 备注: 设置字段值 @ 备注: 设置字段值
--> -->
<script lang='ts' setup> <script lang="ts" setup>
import { matrixTable,objectStruct,orgAndUserMatrixCont } from '@/api/matrixapi/type' import { matrixTable, objectStruct, orgAndUserMatrixCont } from "@/api/matrixapi/type";
import { getMatrixField,getNumber,submitMatrixData,haveMatrixCont } from '@/api/matrixapi'; import {
import { Search } from '@element-plus/icons-vue' getMatrixField,
getNumber,
submitMatrixData,
haveMatrixCont,
} from "@/api/matrixapi";
import { Search } from "@element-plus/icons-vue";
/** /**
* 引入页面 * 引入页面
*/ */
import PickOrg from '@/views/matrix/orgoruser/pickorg.vue' import PickOrg from "@/views/matrix/orgoruser/pickorg.vue";
const props = defineProps({ const props = defineProps({
userShow:{ userShow: {
type:Boolean, type: Boolean,
default:false default: false,
}, },
matrixcont:{ matrixcont: {
type:Object, type: Object,
default(){ default() {
return {} return {};
} },
} },
}); });
const emits = defineEmits(["update:userShow"]); // const emits = defineEmits(["update:userShow"]); //
const addFieldLoading = ref(false) const addFieldLoading = ref(false);
const tabelColumn = reactive<matrixTable[]>([]) const tabelColumn = reactive<matrixTable[]>([]);
const tableList = reactive<any[]>([]) const tableList = reactive<any[]>([]);
const loading = ref(false) const loading = ref(false);
const orgOrUserBox = ref(false); // const orgOrUserBox = ref(false); //
const judgePage = ref(false); const judgePage = ref(false);
const orguseInfo = reactive<orgAndUserMatrixCont[]>([]) const orguseInfo = reactive<orgAndUserMatrixCont[]>([]);
const systemMenuTreeProps = { const systemMenuTreeProps = {
children: "child", children: "child",
label: "name", label: "name",
value:"id" value: "id",
} };
const orgOptionsList = ref<any>(); // const orgOptionsList = ref<any>(); //
const tableValue = ref<any>(); // const tableValue = ref<any>(); //
const ids = ref<number[]>([]); //ID const ids = ref<number[]>([]); //ID
/** /**
* 弹窗显示控制 * 弹窗显示控制
*/ */
const field_is_Show = computed({ const field_is_Show = computed({
get: () => props.userShow, get: () => props.userShow,
set: (val) => { set: (val) => {
emits("update:userShow", val); emits("update:userShow", val);
}, },
}); });
/** /**
* 关闭弹窗 * 关闭弹窗
*/ */
function handleCloseBox(){ function handleCloseBox() {
emits("update:userShow", false); emits("update:userShow", false);
initData() initData();
} }
/** /**
* 初始化数据 * 初始化数据
*/ */
function initData(){ function initData() {
orgOptionsList.value?.splice(0,orgOptionsList.value.length); orgOptionsList.value?.splice(0, orgOptionsList.value.length);
// console.log("tableList-------->",tableList.length) // console.log("tableList-------->",tableList.length)
tableList.splice(0, tableList.length); tableList.splice(0, tableList.length);
} }
/** /**
* 监听数据 * 监听数据
*/ */
watch(() => props.userShow,() => { watch(
if(props.userShow){ () => props.userShow,
getMatrixField({id:props.matrixcont.id}) () => {
.then(({data})=>{ if (props.userShow) {
// console.log("---->",data) getMatrixField({ id: props.matrixcont.id })
tabelColumn.splice(0,tabelColumn.length) .then(({ data }) => {
data.factor.forEach(item=>{ console.log("监听数据---->", data);
tabelColumn.push({ tabelColumn.splice(0, tabelColumn.length);
id:item.id, data.factor.forEach((item) => {
label:item.name, tabelColumn.push({
prop:item.pinyin, id: item.id,
types:item.types label: item.name,
}) prop: item.pinyin,
}) types: item.types,
data.outcome.forEach(item=>{ });
tabelColumn.push({ });
id:item.id, data.outcome.forEach((item) => {
label:item.name, tabelColumn.push({
prop:item.pinyin, id: item.id,
types:item.types label: item.name,
}) prop: item.pinyin,
}) types: item.types,
}) });
.finally(()=>{ });
tableList.splice(0,tableList.length) })
haveMatrixCont({id:props.matrixcont.id}) .finally(() => {
.then((data)=>{ tableList.splice(0, tableList.length);
if(data.data&&data.data.length>0){ haveMatrixCont({ id: props.matrixcont.id })
data.data.forEach((item:any)=>{ .then((data) => {
tableList.push(item) console.log("监听数据--11111-->", data);
}) if (data.data && data.data.length > 0) {
} data.data.forEach((item: any) => {
}) tableList.push(item);
.finally(()=>{ });
if(tableList.length<1){ }
addTableHang(); })
} .finally(() => {
}) if (tableList.length < 1) {
}) addTableHang();
} }
}); });
});
}
}
);
/** /**
* 添加行 * 添加行
*/ */
function addTableHang(){ function addTableHang() {
// //
getNumber({id:8}) getNumber({ id: 8 }).then((data) => {
.then((data)=>{ var jks: objectStruct = {};
var jks:objectStruct = {} tabelColumn.forEach((item) => {
tabelColumn.forEach(item=>{ jks[item.prop] = {
jks[item.prop]={ id: item.id,
id:item.id, types: item.types,
types:item.types, number: data.data.uuidstring,
number:data.data.uuidstring, userlist: [],
userlist:[], orgid: 0,
orgid:0, namelist: [],
namelist:[], isedit: false,
isedit:false, pinyin: item.prop,
pinyin:item.prop };
} });
}) tableList.push(jks);
tableList.push(jks) });
}) // console.log("-1111->",props.orglist,props.orgtree)
// console.log("-1111->",props.orglist,props.orgtree)
} }
/** /**
* 提交使用人 * 提交使用人
*/ */
function submitAddMatrixUser(){ function submitAddMatrixUser() {
if(orguseInfo&&orguseInfo.length>0){ if (orguseInfo && orguseInfo.length > 0) {
orguseInfo.splice(0,orguseInfo.length) orguseInfo.splice(0, orguseInfo.length);
} }
// console.log("-->",tableList) // console.log("-->",tableList)
if(tableList&&tableList.length > 0){ if (tableList && tableList.length > 0) {
tableList.forEach((item)=>{ tableList.forEach((item) => {
// console.log("-4->",item,item.bm) // console.log("-4->",item,item.bm)
// if(item&&item.length>=0){ // if(item&&item.length>=0){
// item.forEach((items: any)=>{ // item.forEach((items: any)=>{
// console.log("-2->",items) // console.log("-2->",items)
// }) // })
// } // }
const entries = Object.entries(item); const entries = Object.entries(item);
entries.map((val:any)=>{ entries.map((val: any) => {
// console.log("-2->",val,val[val.length-1].number) // console.log("-2->",val,val[val.length-1].number)
let typeClass = 1 let typeClass = 1;
if(val[val.length-1].types == 1){ if (val[val.length - 1].types == 1) {
typeClass = 2 typeClass = 2;
} }
orguseInfo.push({ orguseInfo.push({
id:0, id: 0,
number:val[val.length-1].number, number: val[val.length - 1].number,
userlist:val[val.length-1].userlist, userlist: val[val.length - 1].userlist,
types:typeClass, types: typeClass,
mcid:props.matrixcont.id, mcid: props.matrixcont.id,
mhid:val[val.length-1].id, mhid: val[val.length - 1].id,
}) });
}) });
});
}
submitMatrixData(orguseInfo).then((data) => {
// console.log("-66666->",data)
handleCloseBox();
});
}) // console.log("-1->",orguseInfo)
}
submitMatrixData(orguseInfo)
.then((data)=>{
// console.log("-66666->",data)
handleCloseBox();
})
// console.log("-1->",orguseInfo)
} }
function sdfdsf(cont:any){ function sdfdsf(cont: any) {
// console.log("-2222222->",cont) // console.log("-2222222->",cont)
if(cont.types<1){ if (cont.types < 1) {
judgePage.value = true judgePage.value = true;
}else{ } else {
judgePage.value = false judgePage.value = false;
} }
cont.isedit=true cont.isedit = true;
orgOrUserBox.value = true orgOrUserBox.value = true;
tableValue.value = cont tableValue.value = cont;
} }
/** /**
* 删除行 * 删除行
*/ */
function delTableHang(id:any){ function delTableHang(id: any) {
// console.log("",id) // console.log("",id)
tableList.splice(id,1) tableList.splice(id, 1);
if(tableList.length<1){ if (tableList.length < 1) {
addTableHang(); addTableHang();
} }
} }
</script> </script>
<template> <template>
<el-dialog v-model="field_is_Show" custom-class="dialog_box" title="矩阵数据维护" :before-close="handleCloseBox" width="80%" draggable> <el-dialog
<PickOrg v-model:orgBoxShow="orgOrUserBox" :ismultiselect="false" :tabledata="tableValue" /> v-model="field_is_Show"
<el-table custom-class="dialog_box"
v-loading="loading" title="矩阵数据维护"
highlight-current-row :before-close="handleCloseBox"
:data="tableList" width="80%"
border draggable
> >
<el-table-column v-for="(item,index) in tabelColumn" :key="index" align="center"> <PickOrg
<!-- 自定义表头 --> v-model:orgBoxShow="orgOrUserBox"
<template #header> :ismultiselect="false"
{{item.label}} :tabledata="tableValue"
</template> />
<!-- 自定义表项/单元格内容 --> <el-table v-loading="loading" highlight-current-row :data="tableList" border>
<template #default="scope"> <el-table-column v-for="(item, index) in tabelColumn" :key="index" align="center">
<div v-if="!scope.row[item.prop].isedit" class="edit_table_row" @dblclick="sdfdsf(scope.row[item.prop])" > <!-- 自定义表头 -->
<el-tag v-for="(itemtext,ti) in scope.row[item.prop].userlist" :key="ti" class="ml-2" size="small">{{ itemtext.name }}</el-tag>&nbsp; <template #header>
</div> {{ item.label }}
<div v-else> </template>
<el-input <!-- 自定义表项/单元格内容 -->
v-model="scope.row[item.prop].namelist" <template #default="scope">
placeholder="请选择" <div
:suffix-icon="Search" v-if="!scope.row[item.prop].isedit"
/> class="edit_table_row"
</div> @dblclick="sdfdsf(scope.row[item.prop])"
</template> >
</el-table-column> <el-tag
<el-table-column label="操作" width="80" align="center"> v-for="(itemtext, ti) in scope.row[item.prop].userlist"
<template #default="scope"> :key="ti"
<el-button type="danger" link @click="delTableHang(scope.$index)">删除</el-button> class="ml-2"
</template> size="small"
</el-table-column> >{{ itemtext.name }}</el-tag
</el-table> >&nbsp;
</div>
<template #footer> <div v-else>
<div class="dialog-footer left_right"> <el-input
<div> v-model="scope.row[item.prop].namelist"
<el-button type="warning" @click="addTableHang">添加数据</el-button> placeholder="请选择"
</div> :suffix-icon="Search"
<div> />
<el-button type="primary" :loading="addFieldLoading" @click="submitAddMatrixUser" > </el-button> </div>
<el-button @click="handleCloseBox"> </el-button> </template>
</div> </el-table-column>
</div> <el-table-column label="操作" width="80" align="center">
</template> <template #default="scope">
<el-button type="danger" link @click="delTableHang(scope.$index)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</el-dialog> <template #footer>
<div class="dialog-footer left_right">
<div>
<el-button type="warning" @click="addTableHang">添加数据</el-button>
</div>
<div>
<el-button
type="primary"
:loading="addFieldLoading"
@click="submitAddMatrixUser"
> </el-button
>
<el-button @click="handleCloseBox"> </el-button>
</div>
</div>
</template>
</el-dialog>
</template> </template>
<style lang='scss' scoped> <style lang="scss" scoped>
.edit_table_row{ .edit_table_row {
display: block; display: block;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.left_right{ .left_right {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
} }
</style> </style>

1087
src/views/matrix/orgoruser/pickorg.vue

File diff suppressed because it is too large
Loading…
Cancel
Save