完成当前使用账号的代码

main
RogerWork 10 months ago
parent d4d50a62a6
commit 6013a316aa
  1. 24
      src/apis/update.js
  2. 61
      src/views/update/index.vue

@ -21,3 +21,27 @@ export const cinema_search = (params) => {
params: req_params params: req_params
}) })
} }
export const cinema_user = () => {
return request({
url: `/update/user/`,
method: 'get',
})
}
export const change_cinema_user = (params) => {
const cinema_id = params['id']
const req_params = {
id: cinema_id,
}
const req_data = JSON.stringify({
'user': params['user'],
})
return request({
url: `/update/update_user/`,
method: 'post',
params: req_params,
data: req_data,
})
}

@ -1,6 +1,6 @@
<script setup> <script setup>
import {onBeforeMount, onMounted, reactive, ref, unref} from 'vue'; import {onBeforeMount, onMounted, reactive, ref, unref} from 'vue';
import {cinema_list, cinema_search} from "@/apis/update.js"; import {cinema_list, cinema_search, cinema_user, change_cinema_user} from "@/apis/update.js";
// region // region
@ -99,6 +99,7 @@ let refresh_loading = ref(false)
async function get_table_data() { async function get_table_data() {
tableData.value = [] tableData.value = []
await cinema_list().then(res => { await cinema_list().then(res => {
console.log(res)
if (Array.isArray(res)) { if (Array.isArray(res)) {
tableData.value = [...res] tableData.value = [...res]
console.log(tableData) console.log(tableData)
@ -121,6 +122,41 @@ onMounted(
) )
// endregion // endregion
// region
//
const selectedUser = ref('')
//
let userData = ref([])
//
onMounted(async () => {
await cinema_user().then((res) => {
console.log('cinema_user')
const user_list = res.map((item, index) => {
return {key: item.id, label: item.username, value: item.username}
})
user_list.unshift({key: 0, label: '暂无', value: '暂无'})
console.log(user_list)
userData.value = [...user_list]
console.log(res)
console.log(userData.value)
}).catch((err) => {
})
})
const cinemaUserChange = (user, id) => {
const params = {user, id}
change_cinema_user(params).then(res => {
}).catch(err => {
})
}
// endregion
// region
// endregion
</script> </script>
<template> <template>
@ -152,8 +188,17 @@ onMounted(
</el-row> </el-row>
</el-form> </el-form>
<el-table :data="tableData" style="width: 100%"> <el-table :data="tableData" style="width: 100%">
<el-table-column prop="update_time" label="最后查询时间" min-width="200"></el-table-column> <el-table-column prop="update_time" label="最后查询时间" min-width="170"></el-table-column>
<el-table-column prop="name" label="影院名称" min-width="200"></el-table-column> <el-table-column prop="selectedUser" label="当前使用人" min-width="120">
<template v-slot="scope">
<el-select v-model="scope.row.user" class="m-2" size="small" laceholder="请选择" style="width: 80px"
@change="cinemaUserChange(scope.row.user, scope.row.id)">
<el-option v-for="data in userData" :key="data.id" :label="data.label"
:value="data.value"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="name" label="影院名称" min-width="250"></el-table-column>
<el-table-column prop="ip" label="影院IP" min-width="120"> <el-table-column prop="ip" label="影院IP" min-width="120">
<template v-slot="scope"> <template v-slot="scope">
<a target="_blank" style="color:#007bff;" v-if="scope.row.ip!=null" <a target="_blank" style="color:#007bff;" v-if="scope.row.ip!=null"
@ -163,11 +208,11 @@ onMounted(
<span v-else> {{ scope.row.ip }}</span> <span v-else> {{ scope.row.ip }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="zz_num" label="专资编码" min-width="120"></el-table-column> <el-table-column prop="zz_num" label="专资编码" min-width="100"></el-table-column>
<el-table-column prop="inner_id" label="鼎新编码" min-width="100"></el-table-column> <el-table-column prop="inner_id" label="鼎新编码" min-width="90"></el-table-column>
<el-table-column prop="sys_ver" label="系统版本" min-width="200"></el-table-column> <el-table-column prop="sys_ver" label="系统版本" min-width="175"></el-table-column>
<el-table-column prop="client_ver" label="客户端版本" min-width="200"></el-table-column> <el-table-column prop="client_ver" label="客户端版本" min-width="150"></el-table-column>
<el-table-column prop="db_user" label="数据库账号" min-width="100"></el-table-column> <el-table-column prop="db_user" label="数据库账号" min-width="90"></el-table-column>
<el-table-column prop="db_pwd" label="数据库密码" min-width="120"></el-table-column> <el-table-column prop="db_pwd" label="数据库密码" min-width="120"></el-table-column>
</el-table> </el-table>
</template> </template>

Loading…
Cancel
Save