This commit is contained in:
xiaoguangbin 2023-11-07 18:10:06 +08:00
commit d273f98264
3 changed files with 120 additions and 109 deletions

View File

@ -4,19 +4,19 @@ import Vue from 'vue'
/** /**
* 发起请求清理后端对sample的缓存 * 发起请求清理后端对sample的缓存
* @param {Array<any>} sampleList * @param {Array<any>} sampleList
*/ */
export const clearSampleCache = (sampleList) => { export const clearSampleCache = sampleList => {
sampleList.forEach(sample => { sampleList.forEach(sample => {
const { inputFileName: fileName, sampleFileName, qcFileName } = sample const { inputFileName: fileName } = sample
let url = '/gamma/delPHDCache', let url = '/gamma/delPHDCache',
params = { fileName } params = { fileName }
if (sample.sampleType == 'B') { if (sample.sampleType == 'B') {
url = '/spectrumAnalysis/deleteSpectrumCacheData' url = '/spectrumAnalysis/deleteSpectrumCacheData'
params = { sampleFileName , qcFileName } params = { sampleFileName: fileName }
} }
deleteAction(url, params) deleteAction(url, params)
store.commit('REMOVE_SAMPLE_DATA', fileName) store.commit('REMOVE_SAMPLE_DATA', fileName)
Vue.ls.remove(`calibration-gamma:${fileName}`) Vue.ls.remove(`calibration-gamma:${fileName}`)
}) })
} }

View File

@ -696,7 +696,7 @@ export default {
this.cancelLastRequest() this.cancelLastRequest()
const cancelToken = this.createCancelToken() const cancelToken = this.createCancelToken()
this.isLoadingGammaGated = true this.isLoadingGammaGated = true
const { sampleId, qcFileName } = this.newSampleData const { sampleId, qcFileName, inputFileName: sampleFileName } = this.newSampleData
const { const {
success, success,
result: { data }, result: { data },
@ -709,6 +709,7 @@ export default {
chartHeight: this.gammaEnergy.length, chartHeight: this.gammaEnergy.length,
channelWidth: this.gammaChannelWidth, channelWidth: this.gammaChannelWidth,
qcFileName, qcFileName,
sampleFileName
}, },
cancelToken cancelToken
) )

View File

@ -4,9 +4,7 @@
<a-card class="scheduling-list"> <a-card class="scheduling-list">
<!-- 标题 --> <!-- 标题 -->
<template slot="title"> <template slot="title">
<div class="card-title"> <div class="card-title">Scheduling</div>
Scheduling
</div>
<div class="line"></div> <div class="line"></div>
</template> </template>
<!-- 标题结束 --> <!-- 标题结束 -->
@ -50,7 +48,7 @@
<!-- 右侧边框结束 --> <!-- 右侧边框结束 -->
</div> </div>
</div> </div>
<custom-empty v-if="!schedulingInfo || !schedulingInfo.length" style="margin-top: 40px;"></custom-empty> <custom-empty v-if="!schedulingInfo || !schedulingInfo.length" style="margin-top: 40px"></custom-empty>
</div> </div>
<!-- 内容结束 --> <!-- 内容结束 -->
</a-card> </a-card>
@ -116,9 +114,30 @@
<custom-modal :title="isAdd ? 'Add' : 'Edit'" :width="845" v-model="visible" :okHandler="submit" destroy-on-close> <custom-modal :title="isAdd ? 'Add' : 'Edit'" :width="845" v-model="visible" :okHandler="submit" destroy-on-close>
<a-spin :spinning="isGettingDetail"> <a-spin :spinning="isGettingDetail">
<div class="account-assign"> <div class="account-assign">
<div class="search">
<!-- 穿梭框左上方搜索 -->
<div class="station-search">
<label>Station Name</label>
<a-input type="text" placeholder="Enter Station Name" v-model="stationName" />
</div>
<!-- 穿梭框左上方搜索结束 -->
<!-- 穿梭框右上方搜索 -->
<div class="account-search">
<label>User Name</label>
<custom-popover-search
placeholder="Enter User Name"
:options="accountList"
:keyword.sync="keyword"
:remote-method="getAccountList"
@add="onAddToList"
></custom-popover-search>
</div>
<!-- 穿梭框右上方搜索结束 -->
</div>
<!-- 穿梭框开始 -->
<a-transfer <a-transfer
:target-keys="targetKeys" :target-keys="targetKeys"
:render="item => item.title" :render="(item) => item.title"
:operations="['Assign', 'Remove']" :operations="['Assign', 'Remove']"
:titles="['Particulate Station', 'Roster personnel']" :titles="['Particulate Station', 'Roster personnel']"
:show-select-all="false" :show-select-all="false"
@ -169,19 +188,7 @@
</a-tree> </a-tree>
</template> </template>
</a-transfer> </a-transfer>
<!-- 穿梭框结束 -->
<!-- 穿梭框右上方搜索 -->
<div class="account-search">
<label>User Name</label>
<custom-popover-search
placeholder="Enter User Name"
:options="accountList"
:keyword.sync="keyword"
:remote-method="getAccountList"
@add="onAddToList"
></custom-popover-search>
</div>
<!-- 穿梭框右上方搜索结束 -->
</div> </div>
</a-spin> </a-spin>
</custom-modal> </custom-modal>
@ -203,9 +210,9 @@ export default {
components: { components: {
VNodes: { VNodes: {
functional: true, functional: true,
render: (_, ctx) => ctx.props.vnodes render: (_, ctx) => ctx.props.vnodes,
}, },
CustomPopoverSearch CustomPopoverSearch,
}, },
data() { data() {
this.dateFormat = dateFormat this.dateFormat = dateFormat
@ -222,7 +229,6 @@ export default {
isGettingDetail: false, // isGettingDetail: false, //
originalTreeData: [], //
targetKeys: [], targetKeys: [],
isGettingStationList: false, isGettingStationList: false,
@ -238,7 +244,8 @@ export default {
isChanging: false, isChanging: false,
dragItem: null, dragItem: null,
fromUserId: '' fromUserId: '',
stationName: '',
} }
}, },
created() { created() {
@ -265,20 +272,7 @@ export default {
this.isGettingStationList = true this.isGettingStationList = true
const { success, result, message } = await getAction('/gardsStations/findPage?pageIndex=1&pageSize=1000') const { success, result, message } = await getAction('/gardsStations/findPage?pageIndex=1&pageSize=1000')
if (success) { if (success) {
const records = result.records this.stationList = result.records
const set = new Set(records.map(item => item.countryCode))
this.originalTreeData = Array.from(set).map((countryCode, index) => {
return {
title: countryCode,
key: index.toString(),
disabled: true,
children: records
.filter(item => item.countryCode == countryCode)
.map(item => ({ title: item.stationCode, key: item.stationId.toString(), children: [] }))
}
})
this.stationList = records
} else { } else {
this.$message.error(message) this.$message.error(message)
} }
@ -296,9 +290,9 @@ export default {
) )
if (success) { if (success) {
const records = result.records const records = result.records
this.accountList = records.map(item => ({ this.accountList = records.map((item) => ({
label: item.username, label: item.username,
value: item.id value: item.id,
})) }))
} else { } else {
this.$message.error(message) this.$message.error(message)
@ -331,20 +325,20 @@ export default {
if (success) { if (success) {
const selectedStations = [] // const selectedStations = [] //
const accountTree = [] // const accountTree = [] //
result.forEach(item => { result.forEach((item) => {
const accountItem = { const accountItem = {
title: item.userName, title: item.userName,
key: item.userId, key: item.userId,
children: [] children: [],
} }
accountTree.push(accountItem) accountTree.push(accountItem)
item.stationList.forEach(station => { item.stationList.forEach((station) => {
selectedStations.push(station.stationId) selectedStations.push(station.stationId)
accountItem.children.push({ accountItem.children.push({
title: station.stationName, title: station.stationName,
key: station.stationId, key: station.stationId,
isLeaf: true isLeaf: true,
}) })
}) })
}) })
@ -365,7 +359,7 @@ export default {
try { try {
const { success } = await deleteAction('/sysTask/deleteById', { const { success } = await deleteAction('/sysTask/deleteById', {
taskId, taskId,
userId userId,
}) })
if (success) { if (success) {
this.$message.success('Delete Success') this.$message.success('Delete Success')
@ -389,10 +383,7 @@ export default {
this.targetKeys = [] this.targetKeys = []
this.accountTreeData = [] this.accountTreeData = []
this.rightAccountChildSelectedKeys = [] this.resetModalState()
this.rightAccountChildExpandedKeys = []
this.checkedAccount = ''
}, },
onEdit() { onEdit() {
@ -402,13 +393,17 @@ export default {
} }
this.isAdd = false this.isAdd = false
this.visible = true this.visible = true
this.resetModalState()
this.getScheduleDetail()
},
resetModalState() {
this.rightAccountChildSelectedKeys = [] this.rightAccountChildSelectedKeys = []
this.rightAccountChildExpandedKeys = [] this.rightAccountChildExpandedKeys = []
this.checkedAccount = '' this.checkedAccount = ''
this.stationName = ''
this.keyword = '' this.keyword = ''
this.getScheduleDetail()
}, },
async onImport({ file }) { async onImport({ file }) {
@ -449,7 +444,7 @@ export default {
day: this.currentDate.format('YYYY-MM-DD'), day: this.currentDate.format('YYYY-MM-DD'),
fromUserId: this.fromUserId, fromUserId: this.fromUserId,
toUserId, toUserId,
stationIds: [this.dragItem.stationId] stationIds: [this.dragItem.stationId],
}) })
if (success) { if (success) {
this.$message.success('Change Success') this.$message.success('Change Success')
@ -471,7 +466,7 @@ export default {
this.$message.warn('Person List Is Empty') this.$message.warn('Person List Is Empty')
return Promise.reject() return Promise.reject()
} }
if (!this.accountTreeData.some(accountTreeItem => accountTreeItem.children.length)) { if (!this.accountTreeData.some((accountTreeItem) => accountTreeItem.children.length)) {
this.$message.warn('Every Person Has No Station Assigned') this.$message.warn('Every Person Has No Station Assigned')
return Promise.reject() return Promise.reject()
} }
@ -487,16 +482,16 @@ export default {
failMsg = 'Add Fail' failMsg = 'Add Fail'
} }
const params = [] const params = []
this.accountTreeData.forEach(accountTreeItem => { this.accountTreeData.forEach((accountTreeItem) => {
if (accountTreeItem.children.length) { if (accountTreeItem.children.length) {
params.push({ params.push({
schedulingDate: this.currentDate.format('YYYY-MM-DD HH:mm:ss'), schedulingDate: this.currentDate.format('YYYY-MM-DD HH:mm:ss'),
stationList: accountTreeItem.children.map(child => { stationList: accountTreeItem.children.map((child) => {
return { return {
stationId: child.key stationId: child.key,
} }
}), }),
userId: accountTreeItem.key userId: accountTreeItem.key,
}) })
} }
}) })
@ -528,7 +523,7 @@ export default {
// station // station
handleTreeData(data, targetKeys = [], level) { handleTreeData(data, targetKeys = [], level) {
data.forEach(item => { data.forEach((item) => {
if (level !== 0) { if (level !== 0) {
item.disabled = targetKeys.includes(item.key) item.disabled = targetKeys.includes(item.key)
} }
@ -542,13 +537,13 @@ export default {
// 穿 // 穿
onAddToList(selectedAccount) { onAddToList(selectedAccount) {
const addedAccounts = selectedAccount const addedAccounts = selectedAccount
.filter(id => !this.accountTreeData.find(account => account.key == id)) // .filter((id) => !this.accountTreeData.find((account) => account.key == id)) //
.map(id => { .map((id) => {
const find = this.accountList.find(account => account.value == id) const find = this.accountList.find((account) => account.value == id)
return { return {
title: find.label, title: find.label,
key: id, key: id,
children: [] children: [],
} }
}) })
this.accountTreeData.push(...addedAccounts) this.accountTreeData.push(...addedAccounts)
@ -563,7 +558,7 @@ export default {
// 穿 // 穿
const allChildKeys = this.accountTreeData.reduce( const allChildKeys = this.accountTreeData.reduce(
(prev, curr) => prev.concat(curr.children.map(child => child.key)), (prev, curr) => prev.concat(curr.children.map((child) => child.key)),
[] []
) )
itemSelectAll(allChildKeys, false) itemSelectAll(allChildKeys, false)
@ -584,14 +579,14 @@ export default {
this.$message.warning('Please Select A Person To Assign') this.$message.warning('Please Select A Person To Assign')
return return
} }
const findAccount = this.accountTreeData.find(account => account.key == this.checkedAccount) const findAccount = this.accountTreeData.find((account) => account.key == this.checkedAccount)
if (findAccount) { if (findAccount) {
const children = moveKeys.map(key => { const children = moveKeys.map((key) => {
const findStation = this.stationList.find(station => station.stationId == key) const findStation = this.stationList.find((station) => station.stationId == key)
return { return {
isLeaf: true, isLeaf: true,
title: findStation.stationCode, title: findStation.stationCode,
key key,
} }
}) })
findAccount.children.push(...children) findAccount.children.push(...children)
@ -605,7 +600,7 @@ export default {
for (const pIndex in this.accountTreeData) { for (const pIndex in this.accountTreeData) {
// Station // Station
const account = this.accountTreeData[pIndex] const account = this.accountTreeData[pIndex]
const cIndex = account.children.findIndex(child => child.key == moveKey) const cIndex = account.children.findIndex((child) => child.key == moveKey)
if (-1 !== cIndex) { if (-1 !== cIndex) {
parentIndex = pIndex parentIndex = pIndex
childIndex = cIndex childIndex = cIndex
@ -615,19 +610,33 @@ export default {
this.accountTreeData[parentIndex].children.splice(childIndex, 1) this.accountTreeData[parentIndex].children.splice(childIndex, 1)
} }
this.targetKeys = targetKeys this.targetKeys = targetKeys
} },
}, },
computed: { computed: {
treeData() { treeData() {
return this.handleTreeData(cloneDeep(this.originalTreeData), this.targetKeys, 0) const filterData = this.stationList.filter((station) =>
} station.stationCode.toLowerCase().includes(this.stationName.toLowerCase())
)
const set = new Set(filterData.map((item) => item.countryCode))
const originalTreeData = Array.from(set).map((countryCode, index) => {
return {
title: countryCode,
key: index.toString(),
disabled: true,
children: filterData
.filter((item) => item.countryCode == countryCode)
.map((item) => ({ title: item.stationCode, key: item.stationId.toString(), children: [] })),
}
})
return this.handleTreeData(cloneDeep(originalTreeData), this.targetKeys, 0)
},
}, },
watch: { watch: {
currentMonth() { currentMonth() {
this.currentDate = this.currentMonth.clone() this.currentDate = this.currentMonth.clone()
this.getList() this.getList()
} },
} },
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@ -857,15 +866,37 @@ export default {
} }
.account-assign { .account-assign {
position: relative;
width: 672px; width: 672px;
margin: 0 auto; margin: 0 auto;
.search {
display: flex;
justify-content: space-between;
.station-search,
.account-search {
width: 282px;
display: flex;
align-items: center;
label {
color: #5b9cba;
font-size: 16px;
flex-shrink: 0;
margin-right: 10px;
user-select: none;
}
}
}
.ant-transfer { .ant-transfer {
margin-top: 15px;
margin-bottom: 10px; margin-bottom: 10px;
::v-deep { ::v-deep {
.ant-transfer-list { .ant-transfer-list {
width: 282px; width: 282px;
height: 411px; height: 364px;
&-header { &-header {
height: 37px; height: 37px;
&-selected { &-selected {
@ -884,12 +915,6 @@ export default {
} }
} }
} }
&:last-child {
height: 364px;
position: relative;
top: 47px;
}
} }
.ant-transfer-operation { .ant-transfer-operation {
@ -932,21 +957,6 @@ export default {
} }
} }
} }
.account-search {
position: absolute;
top: 0;
right: 0;
width: 282px;
display: flex;
align-items: center;
label {
color: #5b9cba;
font-size: 16px;
flex-shrink: 0;
margin-right: 10px;
user-select: none;
}
}
} }
.ant-select-dropdown-content::before { .ant-select-dropdown-content::before {
top: 2px; top: 2px;