|
@@ -1,177 +0,0 @@
|
|
|
-
|
|
|
-<template>
|
|
|
- <div class="form-container">
|
|
|
- <Form :model="formTop" label-position="top">
|
|
|
- <FormItem label="科目">
|
|
|
- <Select v-model="formTop.subject">
|
|
|
- <Option v-for="(item,index) in currentPeriod.subjects" :value="item.subjectCode" :key="index">{{ item.subjectName }}</Option>
|
|
|
- </Select>
|
|
|
- </FormItem>
|
|
|
- <FormItem label="名称">
|
|
|
- <Input v-model="formTop.name" placeholder="请输入知识块名称,必填项"></Input>
|
|
|
- </FormItem>
|
|
|
- <FormItem>
|
|
|
- <Button @click="handleSubmit" :loading="isLoading">确认</Button>
|
|
|
- </FormItem>
|
|
|
- </Form>
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-
|
|
|
-<script>
|
|
|
- import '@/utils/Math.uuid'
|
|
|
- export default {
|
|
|
- props: ['originData', 'periodIndex', 'subjectIndex', 'addType', 'editBlock'],
|
|
|
- data() {
|
|
|
- return {
|
|
|
- originDatas: {},
|
|
|
- currentPeriod: {},
|
|
|
- editItem: null,
|
|
|
- addPointType: 'school',
|
|
|
- isLoading: false,
|
|
|
- uuid: '',
|
|
|
- formTop: {
|
|
|
- subject: '',
|
|
|
- grade: '',
|
|
|
- semester: '',
|
|
|
- name: ''
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- created() {
|
|
|
-
|
|
|
- },
|
|
|
- methods: {
|
|
|
- // 提交添加
|
|
|
- handleSubmit() {
|
|
|
- let newName = this.formTop.name
|
|
|
- if (!newName) {
|
|
|
- this.$Message.warning('知识块名称不能为空!')
|
|
|
- } else {
|
|
|
- this.isLoading = true
|
|
|
- this.uuid = Math.uuid()
|
|
|
- let params = {
|
|
|
- type: 0,
|
|
|
- name: this.formTop.name,
|
|
|
- alias: this.formTop.name,
|
|
|
- subjectCode: this.formTop.subject,
|
|
|
- partitionKey: this.addPointType === 'school' ? this.originDatas.schoolCode : 'personal',
|
|
|
- order: 706,
|
|
|
- status: 1,
|
|
|
- knowledgeId: this.uuid,
|
|
|
- period: this.currentPeriod.periodCode,
|
|
|
- points: [],
|
|
|
- scope: 'school',
|
|
|
- TEAMModelId:"habook#001",
|
|
|
- source: 1
|
|
|
- }
|
|
|
- if (this.editItem) {
|
|
|
- params.knowledgeId = this.editItem.knowledgeId
|
|
|
- params.points = this.editItem.points
|
|
|
- params.id = this.editItem.id
|
|
|
- }
|
|
|
- this.$api.knowledge.SaveOrUpdateKnowledge([params]).then(res => {
|
|
|
- if (!res.error && res.result.data) {
|
|
|
- this.$emit('addFinish', false)
|
|
|
- } else {
|
|
|
- this.$Message.warning('操作失败,错误代码:' + res.error.code + ',错误信息:' + res.error.message)
|
|
|
- }
|
|
|
- this.closeModal()
|
|
|
- this.editItem = null
|
|
|
- this.isLoading = false
|
|
|
- }).catch(err => {
|
|
|
- console.log(err)
|
|
|
- this.$Message.warning('操作失败')
|
|
|
- this.isLoading = false
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- // 添加完成 关闭窗口
|
|
|
- closeModal() {
|
|
|
- this.formTop.name = ''
|
|
|
- }
|
|
|
- },
|
|
|
- mounted() {
|
|
|
- },
|
|
|
- watch: {
|
|
|
- addType: {
|
|
|
- handler(newValue, oldValue) {
|
|
|
- if (newValue) {
|
|
|
- this.addPointType = newValue
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- originData: {
|
|
|
- handler(newValue, oldValue) {
|
|
|
- this.originDatas = newValue
|
|
|
- }
|
|
|
- },
|
|
|
- periodIndex: {
|
|
|
- handler(newValue, oldValue) {
|
|
|
- this.currentPeriod = this.originDatas.period[newValue]
|
|
|
- this.formTop.subject = this.currentPeriod.subjects[0].subjectCode
|
|
|
- this.formTop.name = ''
|
|
|
- }
|
|
|
- },
|
|
|
- subjectIndex: {
|
|
|
- handler(newValue, oldValue) {
|
|
|
- this.formTop.subject = this.currentPeriod.subjects[newValue].subjectCode
|
|
|
- }
|
|
|
- },
|
|
|
- editBlock: {
|
|
|
- handler(newValue, oldValue) {
|
|
|
- console.log(newValue)
|
|
|
- if (newValue) { // 有编辑册别传过来则为编辑状态
|
|
|
- this.editItem = newValue
|
|
|
- this.formTop.subject = newValue.subjectCode
|
|
|
- this.formTop.name = newValue.name
|
|
|
- } else { // 否则为新增状态
|
|
|
- this.formTop.subject = this.currentPeriod.subjects[0].subjectCode
|
|
|
- this.formTop.name = ''
|
|
|
- this.editItem = newValue
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-</script>
|
|
|
-
|
|
|
-<style>
|
|
|
- .form-container .ivu-form .ivu-form-item-label {
|
|
|
- color: #fff;
|
|
|
- margin: 10px 0;
|
|
|
- font-size: 16px;
|
|
|
- }
|
|
|
-
|
|
|
- .form-container .ivu-input {
|
|
|
- background: #575757;
|
|
|
- border-color: transparent;
|
|
|
- height: 35px;
|
|
|
- color: #fff;
|
|
|
- }
|
|
|
-
|
|
|
- .form-container .ivu-input::-webkit-input-placeholder {
|
|
|
- color: #808080;
|
|
|
- }
|
|
|
-
|
|
|
- .form-container .ivu-select-single .ivu-select-selection {
|
|
|
- background: #575757;
|
|
|
- color: #fbfbfb;
|
|
|
- border-color: transparent;
|
|
|
- height: 35px;
|
|
|
- }
|
|
|
-
|
|
|
- .form-container .ivu-select-single .ivu-select-arrow {
|
|
|
- color: #fbfbfb;
|
|
|
- }
|
|
|
-
|
|
|
- .form-container .ivu-btn {
|
|
|
- width: 100%;
|
|
|
- height: 40px;
|
|
|
- background: rgb(11, 151, 117);
|
|
|
- border: none;
|
|
|
- color: #fff;
|
|
|
- }
|
|
|
-</style>
|