|
@@ -208,10 +208,10 @@
|
|
|
<span class="dialog-footer">
|
|
|
<el-button @click="adddialog = false">取消</el-button>
|
|
|
<el-button type="primary" @click="addschoolfn()" v-if="checkboxArr.length !==0">
|
|
|
- 添加
|
|
|
+ 确认
|
|
|
</el-button>
|
|
|
<el-button type="info" v-if="checkboxArr.length ===0" disabled>
|
|
|
- 添加
|
|
|
+ 确认
|
|
|
</el-button>
|
|
|
</span>
|
|
|
</template>
|
|
@@ -267,7 +267,7 @@
|
|
|
</template>
|
|
|
<script setup>
|
|
|
import option_cn from '@/static/regions/region_cn.json'
|
|
|
-import { ref, getCurrentInstance, watch, h } from 'vue'
|
|
|
+import { ref, getCurrentInstance, watch, h, nextTick } from 'vue'
|
|
|
import { ElMessage, TableV2SortOrder, ElLoading, ElCheckbox } from 'element-plus'
|
|
|
import { Search, CirclePlus } from '@element-plus/icons-vue'
|
|
|
import Details from './details.vue'
|
|
@@ -277,6 +277,7 @@ let direction = ref('ttb')
|
|
|
let activeNames = ref(['1'])
|
|
|
let showState = ref('default')
|
|
|
let findValue = ref()
|
|
|
+let test = ref([])
|
|
|
let columns = ref([
|
|
|
// {
|
|
|
// key: "id",
|
|
@@ -358,13 +359,14 @@ let columns = ref([
|
|
|
])
|
|
|
const searchColumns = [
|
|
|
{
|
|
|
- cellRenderer: (data) =>
|
|
|
- h(
|
|
|
- ElCheckbox,
|
|
|
- // { onClick: () => handleDelete(data), type: "danger", icon: "Delete" },
|
|
|
- { onChange: () => selectChange(data.rowData) },
|
|
|
- { default: () => "" }
|
|
|
- ),
|
|
|
+ // cellRenderer: (data) =>
|
|
|
+ // h(
|
|
|
+ // ElCheckbox,
|
|
|
+ // // { onClick: () => handleDelete(data), type: "danger", icon: "Delete" },
|
|
|
+ // { onChange: () => selectChange(data.rowData) },
|
|
|
+ // { modelValue: () => modelValue = data.rowData },
|
|
|
+ // { default: () => "" }
|
|
|
+ // ),
|
|
|
width: 50,//当前列的宽度,必须设置
|
|
|
// fixed: true,//是否固定列
|
|
|
align: 'center',
|
|
@@ -373,6 +375,11 @@ const searchColumns = [
|
|
|
// const onChange = (value: CheckboxValueType) => (rowData.checked = value)
|
|
|
// return <SelectionCell value={rowData.checked} onChange={onChange} />
|
|
|
// },
|
|
|
+ cellRenderer: (data) => (
|
|
|
+ <>
|
|
|
+ <el-checkbox v-model={data.rowData.checkboxs} onChange={selectChange.bind(this, data.rowData)}></el-checkbox>
|
|
|
+ </>
|
|
|
+ )
|
|
|
},
|
|
|
{
|
|
|
// key: "name",
|
|
@@ -602,6 +609,7 @@ function dataInit () {
|
|
|
dataSource.value.school = res.scInfos
|
|
|
res.scInfos.forEach((items) => {
|
|
|
let areId = items.areaId
|
|
|
+ items.checkboxs = false
|
|
|
dataList.forEach((itemA) => {
|
|
|
areId === itemA.id ? itemA.children.push(items) : ''
|
|
|
})
|
|
@@ -761,28 +769,15 @@ function remoteMethod (key) {
|
|
|
}
|
|
|
function beforefilter () {
|
|
|
let keyvalue = addvalue.value
|
|
|
- let data = { schoolIds: [keyvalue] }
|
|
|
- proxy.$api.getfilterSchool(data).then((res) => {
|
|
|
- console.log(res, 'scback')
|
|
|
- if (res.state === 200 && res.data.length > 0) {
|
|
|
- addschool.value.name = res.data[0].name
|
|
|
- addschool.value.id = res.data[0].id
|
|
|
- addschool.value.region = res.data[0].region
|
|
|
- addschool.value.province = res.data[0].province
|
|
|
- addschool.value.city = res.data[0].city
|
|
|
- addschool.value.dist = res.data[0].dist
|
|
|
- addschool.value.areaId = res.data[0].areaId
|
|
|
- addschool.value.isvirtual = res.data[0].isvirtual
|
|
|
- } else {
|
|
|
- //searchInit()
|
|
|
- ElMessage.info('未查询到相关学校信息,请确认学校简码')
|
|
|
- }
|
|
|
- }).catch((error) => {
|
|
|
- ElMessage.error('API异常,未查询到信息')
|
|
|
+ let arr = dataSource.value.originalSchool
|
|
|
+ let newArr = arr.filter((item) => {
|
|
|
+ return item.name.includes(keyvalue) || item.id.includes(keyvalue)
|
|
|
})
|
|
|
+ tableData.value = newArr
|
|
|
}
|
|
|
//搜索清空
|
|
|
function searchInit () {
|
|
|
+ // checkboxArr.value = checkboxArr.value.length > 0 ? checkboxArr.value : []
|
|
|
addschool.value.name = ''
|
|
|
addschool.value.id = ''
|
|
|
addschool.value.region = ''
|
|
@@ -790,43 +785,58 @@ function searchInit () {
|
|
|
addschool.value.city = ''
|
|
|
addschool.value.dist = ''
|
|
|
addschool.value.isvirtual = false
|
|
|
+ tableData.value.forEach(item => item.checkboxs = false)
|
|
|
+ // console.log(checkboxArr.value)
|
|
|
}
|
|
|
//添加虚拟学校
|
|
|
function addschoolfn () {
|
|
|
let resultA = options.value.findIndex(item => item.id === 'notarea')
|
|
|
console.log(resultA, '值')
|
|
|
- resultA === -1 ? options.value.push({ id: 'notarea', name: '*已搜索学校*', province: '', city: '', children: [] }) : ''
|
|
|
- let ids = addschool.value.id
|
|
|
- let pushArr = [addschool.value.areaId, addschool.value.id]
|
|
|
+ resultA === -1 ? options.value.push({ id: 'notarea', name: '*手动添加学校*', province: '', city: '', children: [] }) : ''
|
|
|
+ console.log(checkboxArr.value, '选择的学校')
|
|
|
+ let checkList = checkboxArr.value
|
|
|
let dataArr = options.value
|
|
|
- if (!addschool.value.areaId) {
|
|
|
- console.log('进入未归区学校或虚拟学校')
|
|
|
- dataArr.forEach((item) => {
|
|
|
- item.id === 'notarea' ? (item.children.push(addschool.value), optionsValue.value.push(['notarea', addschool.value.id])) : ''
|
|
|
- })
|
|
|
- options.value = JSON.parse(JSON.stringify(dataArr))
|
|
|
- console.log(options.value)
|
|
|
- } else {
|
|
|
- console.log(pushArr, optionsValue.value, '进入有学区的学校')
|
|
|
- console.log(options.value)
|
|
|
- optionsValue.value = typeof (optionsValue.value) === 'object' ? optionsValue.value : []
|
|
|
- console.log(optionsValue.value, '看值有没有发生变化')
|
|
|
- optionsValue.value.forEach((itemV) => {
|
|
|
- itemV[1] === addschool.value.id
|
|
|
- })
|
|
|
- for (let i in optionsValue.value) {
|
|
|
- if (optionsValue.value[i][1] === addschool.value.id) {
|
|
|
- ElMessage.info('添加学校已选中,请勿重复添加')
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
- dataArr.forEach((item) => {
|
|
|
- item.children.length > 0 ? item.children.forEach((itemc) => { itemc.id === ids ? (optionsValue.value.push(pushArr)) : '' }) : ''
|
|
|
- // item.id === 'notarea' ? (item.children.push(addschool.value), optionsValue.value.push(pushArr)) : ''
|
|
|
- })
|
|
|
- options.value = JSON.parse(JSON.stringify(dataArr))
|
|
|
- }
|
|
|
+ optionsValue.value = typeof (optionsValue.value) === 'object' ? optionsValue.value : []
|
|
|
+ checkList.forEach((item) => {
|
|
|
+ for (let i in optionsValue.value) { if (item.id === optionsValue.value[i][1]) { return } }
|
|
|
+ // if (item.areaId && item.id) {
|
|
|
+ // optionsValue.value.push([item.areaId, item.id])
|
|
|
+ // }
|
|
|
+ item.areaId && item.id ? optionsValue.value.push([item.areaId, item.id]) : dataArr.forEach((itemc) => { itemc.id === 'notarea' ? itemc.children.push(item) : '' }), optionsValue.value.push(['notarea', item.id])
|
|
|
+ })
|
|
|
+ options.value = JSON.parse(JSON.stringify(dataArr))
|
|
|
adddialog.value = false
|
|
|
+ // let ids = addschool.value.id
|
|
|
+ // let pushArr = [addschool.value.areaId, addschool.value.id]
|
|
|
+ // let dataArr = options.value
|
|
|
+ // if (!addschool.value.areaId) {
|
|
|
+ // console.log('进入未归区学校或虚拟学校')
|
|
|
+ // dataArr.forEach((item) => {
|
|
|
+ // item.id === 'notarea' ? (item.children.push(addschool.value), optionsValue.value.push(['notarea', addschool.value.id])) : ''
|
|
|
+ // })
|
|
|
+ // options.value = JSON.parse(JSON.stringify(dataArr))
|
|
|
+ // console.log(options.value)
|
|
|
+ // } else {
|
|
|
+ // console.log(pushArr, optionsValue.value, '进入有学区的学校')
|
|
|
+ // console.log(options.value)
|
|
|
+ // optionsValue.value = typeof (optionsValue.value) === 'object' ? optionsValue.value : []
|
|
|
+ // console.log(optionsValue.value, '看值有没有发生变化')
|
|
|
+ // optionsValue.value.forEach((itemV) => {
|
|
|
+ // itemV[1] === addschool.value.id
|
|
|
+ // })
|
|
|
+ // for (let i in optionsValue.value) {
|
|
|
+ // if (optionsValue.value[i][1] === addschool.value.id) {
|
|
|
+ // ElMessage.info('添加学校已选中,请勿重复添加')
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // dataArr.forEach((item) => {
|
|
|
+ // item.children.length > 0 ? item.children.forEach((itemc) => { itemc.id === ids ? (optionsValue.value.push(pushArr)) : '' }) : ''
|
|
|
+ // // item.id === 'notarea' ? (item.children.push(addschool.value), optionsValue.value.push(pushArr)) : ''
|
|
|
+ // })
|
|
|
+ // options.value = JSON.parse(JSON.stringify(dataArr))
|
|
|
+ // }
|
|
|
+ // adddialog.value = false
|
|
|
}
|
|
|
//获取所有学校列表 5.18日 调整搜索为 学校列表的形式
|
|
|
function selectChange (value) {
|
|
@@ -841,7 +851,6 @@ function selectChange (value) {
|
|
|
checkboxArr.value.splice(indexNums, 1)
|
|
|
}
|
|
|
}
|
|
|
- console.log(checkboxArr.value)
|
|
|
}
|
|
|
// init()
|
|
|
dataInit()
|
|
@@ -855,9 +864,9 @@ watch(activeNames, (newdata) => {
|
|
|
})
|
|
|
watch(addvalue, (newvalue) => {
|
|
|
if (newvalue.trim().length !== 0) {
|
|
|
- debounce(beforefilter, 800)
|
|
|
+ debounce(beforefilter, 500)
|
|
|
} else {
|
|
|
-
|
|
|
+ tableData.value = dataSource.value.originalSchool
|
|
|
}
|
|
|
})
|
|
|
watch(clickNum, (newv) => {
|
|
@@ -1083,6 +1092,7 @@ watch(clickNum, (newv) => {
|
|
|
.result-box .el-table-v2__row-cell {
|
|
|
width: v-bind(searchWidth + "%") !important;
|
|
|
/* width: 12% !important; */
|
|
|
+ line-height: 16px;
|
|
|
}
|
|
|
.result-box .cheboxclass {
|
|
|
width: 7% !important;
|
|
@@ -1090,4 +1100,8 @@ watch(clickNum, (newv) => {
|
|
|
.result-box .el-table-v2__row-cell:nth-child(1) {
|
|
|
width: 7% !important;
|
|
|
}
|
|
|
+.result-box .el-table-v2__row {
|
|
|
+ width: 100% !important;
|
|
|
+ height: 56px !important;
|
|
|
+}
|
|
|
</style>
|