|
|
@@ -26,6 +26,14 @@
|
|
|
>{{ scope.row.num }}</el-link>
|
|
|
</template>
|
|
|
|
|
|
+ <template #table-column-name="{scope}">
|
|
|
+ <el-link
|
|
|
+ :underline="true"
|
|
|
+ @click="getItemList(scope.row)"
|
|
|
+ style="font-size:12px;display:inline-block;color:#409EFF"
|
|
|
+ >{{ scope.row.name }}</el-link>
|
|
|
+ </template>
|
|
|
+
|
|
|
<template #table-column-inTurn="{scope}">
|
|
|
<span v-if="!sort.status">{{ scope.row.inTurn }}</span>
|
|
|
<el-input-number
|
|
|
@@ -58,19 +66,46 @@
|
|
|
</template>
|
|
|
|
|
|
<!-- 添加分类 -->
|
|
|
- <template #slot-add-goods-btn="{scope}">
|
|
|
- <el-button type="primary" size="mini" @click="getItemList(scope.row)">添加</el-button>
|
|
|
+ <template #slot-add-goods-btn>
|
|
|
+ <el-button type="primary" size="mini" @click="replaceBtnFn(0)">添加</el-button>
|
|
|
</template>
|
|
|
|
|
|
<template #slot-item-list="{scope}">
|
|
|
- <el-button type="text" @click="getItemList(scope.row)">花材列表</el-button>
|
|
|
+ <el-button type="text" @click="getItemList(scope.row)">查看花材</el-button>
|
|
|
</template>
|
|
|
|
|
|
<template #slot-modify="{scope}">
|
|
|
- <el-button type="text" @click="getItemList(scope.row)">修改</el-button>
|
|
|
+ <el-button type="text" @click="replaceBtnFn(scope.row.id,scope.row.name)">修改</el-button>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template #slot-delete="{scope}">
|
|
|
+ <el-button type="text" @click="deleteFn(scope.row.id)">删除</el-button>
|
|
|
</template>
|
|
|
|
|
|
</x-crud>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 新增弹窗 -->
|
|
|
+ <el-dialog
|
|
|
+ :title="`${id == 0 ? '添加' : '修改'}花材`"
|
|
|
+ :visible.sync="replaceDialog"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ width="600px"
|
|
|
+ >
|
|
|
+ <div class="ad-modal-content">
|
|
|
+ <el-form :model="replaceForm" :rules="ruleForm" ref="replaceForm" label-width="100px" class="demo-form">
|
|
|
+ <el-form-item label="分类名称" prop="name">
|
|
|
+ <el-input v-model="replaceForm.name" placeholder="请输入名称" size="small"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button size="small" @click="resetForm">取 消</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="submitForm('replaceForm')">确认</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -86,19 +121,76 @@ export default {
|
|
|
tabIndex: '0',
|
|
|
tabsData: [
|
|
|
{
|
|
|
- text: '分类',
|
|
|
+ text: '花材分类',
|
|
|
key: '0'
|
|
|
}
|
|
|
],
|
|
|
selects: {},
|
|
|
sort: {
|
|
|
status: false
|
|
|
- }
|
|
|
+ },
|
|
|
+ replaceDialog:false,
|
|
|
+ id:0,
|
|
|
+ replaceForm: {
|
|
|
+ name: ''
|
|
|
+ },
|
|
|
+ ruleForm: {
|
|
|
+ name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
|
|
|
+ },
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
},
|
|
|
methods: {
|
|
|
+ deleteFn(id){
|
|
|
+ let self = this
|
|
|
+ this.$confirm('确认删除?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.$service.itemClass.deleteClass({id:id}).then(res => {
|
|
|
+ self.replaceDialog = false
|
|
|
+ self.app.refresh();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ resetForm(){
|
|
|
+ this.$refs['replaceForm'].resetFields();
|
|
|
+ this.replaceDialog = false
|
|
|
+ },
|
|
|
+ replaceFn() {
|
|
|
+ let replaceForm = JSON.parse(JSON.stringify(this.replaceForm));
|
|
|
+ let self = this
|
|
|
+ if (self.id == 0) {
|
|
|
+ this.$service.itemClass.addClass(replaceForm).then(res => {
|
|
|
+ self.replaceDialog = false
|
|
|
+ self.resetForm();
|
|
|
+ self.app.refresh();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$service.itemClass.updateClass({id:self.id,...replaceForm}).then(res => {
|
|
|
+ self.replaceDialog = false
|
|
|
+ self.resetForm();
|
|
|
+ self.app.refresh();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ submitForm(formName) {
|
|
|
+ this.$refs[formName].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ this.replaceFn();
|
|
|
+ } else {
|
|
|
+ console.log('error submit!!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ replaceBtnFn(id,name) {
|
|
|
+ this.id = id
|
|
|
+ this.replaceForm.name = name
|
|
|
+ this.replaceDialog = true
|
|
|
+ },
|
|
|
handleClick(tab, e) {
|
|
|
this.app.refresh({ type: this.tabIndex });
|
|
|
},
|
|
|
@@ -153,7 +245,7 @@ export default {
|
|
|
fixed: 'right',
|
|
|
label: '操作'
|
|
|
},
|
|
|
- layout: ['slot-item-list','slot-modify','delete',]
|
|
|
+ layout: ['slot-item-list','slot-modify','slot-delete',]
|
|
|
}
|
|
|
})
|
|
|
.set('dict', {
|