|
@@ -13,12 +13,27 @@
|
|
|
</el-col>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
+ <el-dialog :visible.sync="dialog" title="栏目" @close="toClose" width="30%">
|
|
|
+ <data-form :data="form" :fields="formFields" :rules="{}" @save="turnSave">
|
|
|
+ <template #options="{item}">
|
|
|
+ <template v-if="item.model === 'site'">
|
|
|
+ <el-option label="招聘信息" value="zpxx"></el-option>
|
|
|
+ <el-option label="就业指导" value="jyzd"></el-option>
|
|
|
+ <el-option label="学习实践" value="xxsj"></el-option>
|
|
|
+ <el-option label="勤工俭学" value="qgjx"></el-option>
|
|
|
+ <el-option label="工作顾问" value="gzgw"></el-option>
|
|
|
+ <el-option label="adsdadas" value="dasdasd"></el-option>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </data-form>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import breadcrumb from '@c/common/breadcrumb.vue';
|
|
|
import dataTable from '@/components/frame/filter-page-table.vue';
|
|
|
+import dataForm from '@/components/frame/form.vue';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
const { mapActions: mapColumn } = createNamespacedHelpers('talentColumn');
|
|
|
export default {
|
|
@@ -30,6 +45,7 @@ export default {
|
|
|
components: {
|
|
|
breadcrumb,
|
|
|
dataTable,
|
|
|
+ dataForm,
|
|
|
},
|
|
|
data: function() {
|
|
|
return {
|
|
@@ -48,23 +64,69 @@ export default {
|
|
|
fields: [{ label: '名称', prop: 'name' }],
|
|
|
list: [],
|
|
|
total: 0,
|
|
|
+ dialog: false,
|
|
|
+ form: {},
|
|
|
+ formFields: [
|
|
|
+ { label: '名称', model: 'name' },
|
|
|
+ { label: '所在位置', model: 'site', type: 'select' },
|
|
|
+ ],
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
this.search();
|
|
|
},
|
|
|
methods: {
|
|
|
- ...mapColumn(['query', 'delete']),
|
|
|
+ ...mapColumn(['query', 'delete', 'update', 'create']),
|
|
|
// 查询列表
|
|
|
async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
const res = await this.query({ skip, limit, ...info });
|
|
|
if (this.$checkRes(res)) {
|
|
|
this.$set(this, `list`, res.data);
|
|
|
this.$set(this, `total`, res.total);
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.errmsg,
|
|
|
+ type: 'error',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 保存信息
|
|
|
+ async turnSave({ data }) {
|
|
|
+ if (data.id) {
|
|
|
+ const res = await this.update(data);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$message({
|
|
|
+ message: '修改成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.toClose();
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.errmsg,
|
|
|
+ type: 'error',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ const res = await this.create(data);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$message({
|
|
|
+ message: '添加成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.toClose();
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.errmsg,
|
|
|
+ type: 'error',
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
// 修改
|
|
|
- toEdit({ data }) {},
|
|
|
+ toEdit({ data }) {
|
|
|
+ this.dialog = true;
|
|
|
+ this.$set(this, `form`, data);
|
|
|
+ },
|
|
|
// 删除
|
|
|
async toDelete({ data }) {
|
|
|
const res = await this.delete(data.id);
|
|
@@ -74,8 +136,19 @@ export default {
|
|
|
type: 'success',
|
|
|
});
|
|
|
this.search();
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.errmsg,
|
|
|
+ type: 'error',
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
+ // 取消
|
|
|
+ toClose() {
|
|
|
+ this.form = {};
|
|
|
+ this.dialog = false;
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['user']),
|