|
@@ -36,7 +36,7 @@
|
|
<div class="operate">
|
|
<div class="operate">
|
|
<button @click="update(scope.row)">编辑</button>
|
|
<button @click="update(scope.row)">编辑</button>
|
|
<button @click="toPage(scope.row)">批量创建</button>
|
|
<button @click="toPage(scope.row)">批量创建</button>
|
|
- <button @click="delete_school(scope.row.id)" style="color:red;">删除</button>
|
|
|
|
|
|
+ <button @click="delete_school(scope.row)" style="color:red;">删除</button>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
@@ -222,6 +222,7 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
|
|
+import { addOp } from "@/api/user";
|
|
import { API_CONFIG } from '@/common/apiConfig';
|
|
import { API_CONFIG } from '@/common/apiConfig';
|
|
import { mapGetters } from 'vuex';
|
|
import { mapGetters } from 'vuex';
|
|
|
|
|
|
@@ -406,7 +407,7 @@ export default {
|
|
// 发起请求
|
|
// 发起请求
|
|
this.$ajax
|
|
this.$ajax
|
|
.post(API_CONFIG.baseUrl, params)
|
|
.post(API_CONFIG.baseUrl, params)
|
|
- .then((res) => {
|
|
|
|
|
|
+ .then(async (res) => {
|
|
// console.log("👉", res.data);
|
|
// console.log("👉", res.data);
|
|
if (res.data && res.data[0] && res.data[0][0]) {
|
|
if (res.data && res.data[0] && res.data[0][0]) {
|
|
if (res.data[0][0].name === 1) {
|
|
if (res.data[0][0].name === 1) {
|
|
@@ -420,6 +421,12 @@ export default {
|
|
type: "success",
|
|
type: "success",
|
|
message: "添加成功!",
|
|
message: "添加成功!",
|
|
});
|
|
});
|
|
|
|
+ await addOp({
|
|
|
|
+ uid: this.userid,
|
|
|
|
+ cid: "",
|
|
|
|
+ type: "user_op",
|
|
|
|
+ content: `添加了学校 ${this.sch_name}`,
|
|
|
|
+ });
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
this.$message.error("插入失败,未返回有效结果");
|
|
this.$message.error("插入失败,未返回有效结果");
|
|
@@ -467,7 +474,7 @@ export default {
|
|
];
|
|
];
|
|
this.$ajax
|
|
this.$ajax
|
|
.post(API_CONFIG.baseUrl, params)
|
|
.post(API_CONFIG.baseUrl, params)
|
|
- .then((res) => {
|
|
|
|
|
|
+ .then(async (res) => {
|
|
console.log("👉", res.data);
|
|
console.log("👉", res.data);
|
|
this.add_school_dialog2 = false;
|
|
this.add_school_dialog2 = false;
|
|
this.$message({
|
|
this.$message({
|
|
@@ -475,15 +482,20 @@ export default {
|
|
type: 'success'
|
|
type: 'success'
|
|
});
|
|
});
|
|
this.getSchool();
|
|
this.getSchool();
|
|
-
|
|
|
|
|
|
+ await addOp({
|
|
|
|
+ uid: this.userid,
|
|
|
|
+ cid: "",
|
|
|
|
+ type: "user_op",
|
|
|
|
+ content: `修改了学校 ${this.sch_name}${this.nid}`,
|
|
|
|
+ });
|
|
})
|
|
})
|
|
.catch((err) => {
|
|
.catch((err) => {
|
|
this.$message.error("修改失败");
|
|
this.$message.error("修改失败");
|
|
console.log(err);
|
|
console.log(err);
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- delete_school(id) {
|
|
|
|
- this.nid = id;
|
|
|
|
|
|
+ delete_school(row) {
|
|
|
|
+ this.nid = row.id;
|
|
|
|
|
|
let params = [
|
|
let params = [
|
|
{
|
|
{
|
|
@@ -499,14 +511,19 @@ export default {
|
|
.then(() => {
|
|
.then(() => {
|
|
this.$ajax
|
|
this.$ajax
|
|
.post(API_CONFIG.baseUrl, params)
|
|
.post(API_CONFIG.baseUrl, params)
|
|
- .then((res) => {
|
|
|
|
|
|
+ .then(async (res) => {
|
|
console.log("👉", res.data);
|
|
console.log("👉", res.data);
|
|
this.$message({
|
|
this.$message({
|
|
message: '删除成功',
|
|
message: '删除成功',
|
|
type: 'success'
|
|
type: 'success'
|
|
});
|
|
});
|
|
this.getSchool();
|
|
this.getSchool();
|
|
-
|
|
|
|
|
|
+ await addOp({
|
|
|
|
+ uid: this.userid,
|
|
|
|
+ cid: "",
|
|
|
|
+ type: "user_op",
|
|
|
|
+ content: `删除了学校 ${row.name}${row.id}`,
|
|
|
|
+ });
|
|
})
|
|
})
|
|
})
|
|
})
|
|
.catch((err) => {
|
|
.catch((err) => {
|
|
@@ -514,10 +531,37 @@ export default {
|
|
console.log(err);
|
|
console.log(err);
|
|
});
|
|
});
|
|
},
|
|
},
|
|
- toPage(row) {
|
|
|
|
|
|
+ async getUserId(oid, org) {
|
|
|
|
+ let params = [
|
|
|
|
+ {
|
|
|
|
+ functionName: "select_Suffix", // 调用存储过程的名称
|
|
|
|
+ org: org, //组织id
|
|
|
|
+ oid: oid, //学校id
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ const res = await this.$ajax.post(API_CONFIG.baseUrl, params);
|
|
|
|
+ console.log('getSuffix', res);
|
|
|
|
+ let data = res.data[0];
|
|
|
|
+ let orgData = res.data[1];
|
|
|
|
+ let ap = data.length > 0 ? data[0].userid : orgData.length > 0 ? orgData[0].userid : "";
|
|
|
|
+ return ap
|
|
|
|
+ } catch (err) {
|
|
|
|
+ console.error("请求失败,错误信息:", err);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ async toPage(row) {
|
|
const oid = row.id;
|
|
const oid = row.id;
|
|
const org = row.org;
|
|
const org = row.org;
|
|
- const url=`https://pbl.cocorobo.cn/pbl-teacher-table/dist/?#/teacher?userid=${this.userid}&oid=${oid}&org=${org}`;
|
|
|
|
|
|
+ let userid = await this.getUserId(oid, org);
|
|
|
|
+ await addOp({
|
|
|
|
+ uid: this.userid,
|
|
|
|
+ cid: "",
|
|
|
|
+ type: "user_op",
|
|
|
|
+ content: `点击了批量添加 ${row.name}${row.id}`,
|
|
|
|
+ });
|
|
|
|
+ const url=`https://pbl.cocorobo.cn/pbl-teacher-table/dist/?#/teacher?userid=${userid ? userid : this.userid}&oid=${oid}&org=${org}`;
|
|
window.open(url,'_blank');
|
|
window.open(url,'_blank');
|
|
}
|
|
}
|
|
|
|
|