Init project

This commit is contained in:
alirezakarari
2021-01-09 20:53:13 +03:30
commit 8d06c89a89
1005 changed files with 105625 additions and 0 deletions
+381
View File
@@ -0,0 +1,381 @@
<template>
<a-form :form="form" @submit="handleSubmit">
<a-spin type="loading" :spinning="loading">
<vx-card :title="!this.$route.params.id ? 'ساخت دسته':'ویرایش دسته' ">
<a-button type="primary" ghost style="float:left" html-type="submit">
افزودن
</a-button>
<a-row type="flex" justify="center" >
<a-col :span="8" class="grow-space">
<a-form-item label="نام دسته">
<a-input
v-decorator="['title', { rules: [{ required: true, message: 'واردکردن دسته الزامی است.' }] }]"
autocomplete="off"
/>
</a-form-item>
<a-form-item label="نام های هم خانواده">
<a-input
v-decorator="['synonym', { rules: [{ required: false, message: '' }] }]"
autocomplete="off"
/>
</a-form-item>
<a-form-item label="ناظران دسته">
<a-select
mode="multiple"
style="width: 100%"
placeholder="ناظران دسته"
v-decorator="[
'supervisors',
{ rules: [{ required: false }] },
]"
>
<a-select-option v-for="(item,index) in collection" :value="item.id" :key="index">
{{ item.name }} - {{ item.mobile }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8" class="grow-space">
<a-form-item label="تعداد روز" style="width: 50%;">
<a-input-number :min="1" :max="1000" :default-value="0"
v-decorator="['expired_at', { rules: [{ required: true, message: 'واردکردن تعداد روز آگهی منقضی شده الزامی است.' }] }]"
/>
</a-form-item>
<a-form-item label="پدر دسته">
<a-select
style="width: 100%"
v-decorator="[
'parent_id',
{ rules: [{ required: false }] },
]"
>
<a-select-option v-for="(item,index) in manegerCollection" :value="item.id" :key="index">
{{ item.title }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8" class="grow-space" style="text-align: center;margin-top: 3rem;">
<a-form-item >
<a-upload
v-decorator="[
'icon',
{
valuePropName: 'fileList',
getValueFromEvent: normFile,
},
]"
name="logo"
action="/upload.do"
list-type="picture"
>
<a-button> <a-icon type="upload" /> انتخاب آیکون </a-button>
</a-upload>
</a-form-item>
<a-form-item >
<a-upload
v-decorator="[
'thumb',
{
valuePropName: 'fileList',
getValueFromEvent: normFile,
},
]"
name="logo"
action="/upload.do"
list-type="picture"
>
<a-button> <a-icon type="upload" /> انتخاب تصویر </a-button>
</a-upload>
</a-form-item>
<!--<vs-upload-->
<!--text="انتخاب تصویر"-->
<!--fileName="file"-->
<!--:data="{title:'ok',has_watermark:false,has_thumb:false,type:1}"-->
<!--automatic-->
<!--:headers="headers"-->
<!--action="http://salar.flut.ir/admin/file"-->
<!--@on-success="successUpload" />-->
<a-form-model
ref="dynamicValidateForm"
:model="dynamicValidateForm"
v-bind="formItemLayoutWithOutLabel"
>
</a-form-model>
</a-col>
<div class="checkbox">
<a-form-item>
<a-checkbox v-decorator="['free_adv',{valuePropName: 'checked'}]">
آگهی رایگان
</a-checkbox>
</a-form-item>
<a-form-item>
<a-checkbox v-decorator="['swapable',{valuePropName: 'checked'}]">
معاوضه
</a-checkbox>
</a-form-item>
<a-form-item>
<a-checkbox v-decorator="['show_store',{valuePropName: 'checked'}]">
نمایش فروشگاه در صفحه تک آگهی
</a-checkbox>
</a-form-item>
<a-form-item>
<a-checkbox v-decorator="['show_customer_other_advs',{valuePropName: 'checked'}]">
امکان نمایش آگهی های دیگر این کاربر
</a-checkbox>
</a-form-item>
<a-form-item>
<a-checkbox v-decorator="['has_map',{valuePropName: 'checked'}]">
آگهی ها شامل نقشه باشد
</a-checkbox>
</a-form-item>
<a-form-item>
<a-checkbox v-decorator="['has_in_menu',{valuePropName: 'checked'}]">
دسته در منو نمایش داده شود
</a-checkbox>
</a-form-item>
<a-form-item>
<a-checkbox v-decorator="['has_message_before_expired',{valuePropName: 'checked'}]">
قبل از انقضای آگهی پیام داده شود
</a-checkbox>
</a-form-item>
<a-form-item>
<a-checkbox v-decorator="['has_same_adv',{valuePropName: 'checked'}]">
نمایش آگهی های مشابه
</a-checkbox>
</a-form-item>
<a-form-item>
<a-checkbox v-decorator="['is_rentical',{valuePropName: 'checked'}]">
آگهی شامل نوع اجاره ای شود
</a-checkbox>
</a-form-item>
<a-form-item>
<a-checkbox v-decorator="['is_comparable',{valuePropName: 'checked'}]">
آگهی قابلیت مقایسه داشته باشد
</a-checkbox>
</a-form-item>
<a-form-item>
<a-checkbox v-decorator="['is_count_view',{valuePropName: 'checked'}]">
تعداد بازدید نمایش داده شود
</a-checkbox>
</a-form-item>
<a-form-item>
<a-checkbox v-decorator="['has_comment',{valuePropName: 'checked'}]">
امکان نظر دادن
</a-checkbox>
</a-form-item>
<a-checkbox v-decorator="['for_user',{valuePropName: 'checked'}]">
استفاده شده برای مشاغل
</a-checkbox>
<a-checkbox v-decorator="['for_weblog',{valuePropName: 'checked'}]">
استفاده شده برای وبلاگ
</a-checkbox>
<a-checkbox v-decorator="['for_store',{valuePropName: 'checked'}]">
استفاده شده برای فروشگاه
</a-checkbox>
</div>
</a-row>
</vx-card>
</a-spin>
</a-form>
</template>
<script>
import axios from '@/axios'
import { mapActions } from 'vuex'
export default {
name: "add-group",
data(){
return{
number2:50,
collection:[],
manegerCollection:[],
form: this.$form.createForm(this, { name: 'coordinated' }),
}
},
methods:{
...mapActions([
'sendUserSubmit'
]),
handleSubmit(e) {
e.preventDefault();
this.form.validateFields((err, values) => {
if (!err) {
if(this.$route.params.id){
console.log('edit users',values)
// this.editUsers(this.$route.params.id)
this.$store.dispatch('editCollection', {
id: this.$route.params.id,
data: values
});
this.form.resetFields()
}else{
this.sendUserSubmit(values)
console.log("receive form value:",values)
this.form.resetFields()
}
}
});
},
normFile(e) {
console.log('Upload event:', e);
if (Array.isArray(e)) {
return e;
}
return e && e.fileList;
},
getCollection(){
axios.get('admin/collection/user')
.then((res)=>{
console.log(res.data,'data')
return this.collection = res.data
})
},
async getFatherCollection(){
const {data} = await axios.get('admin/collection/parent')
this.manegerCollection = data
},
successUpload(){
console.log('ok')
this.$vs.notify({color:'success',title:'Upload Success',text:'Lorem ipsum dolor sit amet, consectetur'})
},
addDomain() {
this.dynamicValidateForm.domains.push({
value: '',
key: Date.now(),
});
},
removeDomain(item) {
let index = this.dynamicValidateForm.domains.indexOf(item);
if (index !== -1) {
this.dynamicValidateForm.domains.splice(index, 1);
}
},
},
computed:{
loading(){
if(this.$route.params.id){
return this.$store.state.collection.loading;
}else {
return this.$store.state.loading;
}
},
editCollectionById(){
return this.$route.params && this.$route.params.id != undefined
},
data(){
console.log(this.$store.state.collection.collectionSingle,'collection')
return this.$store.state.collection.collectionSingle
},
},
mounted(){
this.getCollection();
this.getFatherCollection();
if(this.editCollectionById){
this.$store.dispatch('collection/collectionId',this.$route.params.id).then(()=>{
this.form.setFieldsValue(this.data)
});
}
}
}
</script>
<style scoped>
@media(min-width: 940px){
.checkbox{
display: grid;
grid-template-columns: repeat(4,1fr);
}
[dir] .ant-form-item{
margin-bottom:0
}
}
.content-area__content{
padding-bottom: 30px;
}
[dir=rtl] .ant-notification{
z-index: 100000000 !important;
}
.v-nav-menu .vs-sidebar {
z-index: 1 !important;
}
[dir=rtl] .ant-checkbox-wrapper + .ant-checkbox-wrapper{
margin-right: 0 !important;
}
.ant-checkbox-wrapper{
padding: 10px 0;
}
[dir=rtl] .ant-checkbox-checked .ant-checkbox-inner::after{
border-left: 0 !important;
-webkit-transform: rotate(45deg) scale(1) translate(-100%, -25%) !important;
transform: rotate(45deg) scale(1) translate(-100%, -25%) !important;
}
.ant-input-number{
width:100%
}
.grow-space{
padding:0 10px
}
[dir=rtl] .ant-checkbox-wrapper + .ant-checkbox-wrapper[data-v-6c853ba7]
{
white-space: nowrap;
}
/*.ant-btn.ant-btn-primary.ant-btn-background-ghost{*/
/*position: absolute;*/
/*bottom: 0;*/
/*left: 0;*/
/*}*/
</style>
+141
View File
@@ -0,0 +1,141 @@
<template>
<div id="page-user-list">
<vx-card title="لیست دسته" class="vx-card">
<a-button type="primary" @click="add_Collection" class="mb-6">افزودن دسته</a-button>
<XTable :model="model" ref="collection">
<span slot="swap" slot-scope="text,record">
<feather-icon icon="CheckIcon" svgClasses="w-5 h-5 text-success" v-if="text.record.swapable"/>
<feather-icon icon="XIcon" v-else svgClasses="w-5 h-5 text-danger"/>
</span>
<span slot="lta" slot-scope="text,record">
<feather-icon icon="CheckIcon" svgClasses="w-5 h-5 text-success" v-if="text.record.has_lta"/>
<feather-icon icon="XIcon" v-else svgClasses="w-5 h-5 text-danger"/>
</span>
<span slot="store" slot-scope="text,record">
<feather-icon icon="CheckIcon" svgClasses="w-5 h-5 text-success" v-if="text.record.show_store"/>
<feather-icon icon="XIcon" v-else svgClasses="w-5 h-5 text-danger"/>
</span>
<span slot="same_adv" slot-scope="text,record">
<feather-icon icon="CheckIcon" svgClasses="w-5 h-5 text-success" v-if="text.record.has_same_adv"/>
<feather-icon icon="XIcon" v-else svgClasses="w-5 h-5 text-danger"/>
</span>
<span slot="map" slot-scope="text,record">
<feather-icon icon="CheckIcon" svgClasses="w-5 h-5 text-success" v-if="text.record.has_map"/>
<feather-icon icon="XIcon" v-else svgClasses="w-5 h-5 text-danger"/>
</span>
<span slot="menu" slot-scope="text,record">
<feather-icon icon="CheckIcon" svgClasses="w-5 h-5 text-success" v-if="text.record.has_in_menu"/>
<feather-icon icon="XIcon" v-else svgClasses="w-5 h-5 text-danger"/>
</span>
<span slot="comparable" slot-scope="text,record">
<feather-icon icon="CheckIcon" svgClasses="w-5 h-5 text-success" v-if="text.record.is_comparable"/>
<feather-icon icon="XIcon" v-else svgClasses="w-5 h-5 text-danger"/>
</span>
<span slot="comment" slot-scope="text,record">
<feather-icon icon="CheckIcon" svgClasses="w-5 h-5 text-success" v-if="text.record.has_comment"/>
<feather-icon icon="XIcon" v-else svgClasses="w-5 h-5 text-danger"/>
</span>
<span slot="view" slot-scope="text,record">
<feather-icon icon="CheckIcon" svgClasses="w-5 h-5 text-success" v-if="text.record.is_count_view"/>
<feather-icon icon="XIcon" v-else svgClasses="w-5 h-5 text-danger"/>
</span>
<span slot="supervisors_item" slot-scope="text,record">
<div v-for="ele in text.record.supervisors">
<div v-if="ele.user">
<ATag>{{ ele.user.name }}</ATag>
</div>
</div>
</span>
<span slot="icon" slot-scope="text,record" v-if="text.record.icon != null">
<img :src="text.record.icon" width="40" height="40" alt="">
</span>
<span slot="supervisors" slot-scope="text,record">
<div v-for="item in text.record.attributes" v-if="item.attribute">
<ATag>{{ item.attribute.title }}</ATag>
</div>
</span>
<span slot="price" slot-scope="text,record">
<feather-icon icon="CheckIcon" svgClasses="w-5 h-5 text-success" v-if="text.record.show_price"/>
<feather-icon icon="XIcon" v-else svgClasses="w-5 h-5 text-danger"/>
</span>
<span slot="opt" slot-scope="text,record" class="flex space-x-3">
<a-tooltip placement="bottomLeft">
<template slot="title">
<span>حذف</span>
</template>
<a-popconfirm
title="آیا می خواهید حذف کنید؟"
ok-text="بله"
cancel-text="خیر"
@confirm="okDelete(text.record.id)"
>
<feather-icon icon="TrashIcon" svgClasses="w-5 h-5 text-danger" style="cursor: pointer"/>
</a-popconfirm>
</a-tooltip>
<a-tooltip placement="bottomLeft">
<template slot="title">
<span>ویرایش</span>
</template>
<feather-icon icon="EditIcon" @click="edit(text.record.id)" svgClasses="w-5 h-5 text-success" style="cursor: pointer"/>
</a-tooltip>
</span>
</XTable>
</vx-card>
</div>
</template>
<script>
import '@/assets/scss/vuexy/extraComponents/agGridStyleOverride.scss'
import * as TableCol from './CategoryListModel';
import axios from "@/axios";
import XTable from "../../components/x-table/XTable";
export default {
components: {
XTable
},
data() {
return {
model: null,
visible: false,
form: this.$form.createForm(this, { name: 'coordinated' }),
tempRowId:null,
category:undefined
}
},
methods:{
edit(id){
this.$router.push(`/category/edit/${id}`)
},
async okDelete(id){
try{
await axios.put(`admin/collection/delete/${id}`,{op:'delete'})
this.$refs.collection.fetch()
}catch (e) {
this.$ntSetError()
}finally {
}
},
add_Collection(){
this.$router.push('/category/add')
}
},
created() {
this.model = TableCol.default;
// this.getCollection()
},
}
</script>
<style>
.ant-popover {
z-index: 25000000;
}
[dir=rtl] .ant-table .ant-table-row-indent + .ant-table-row-expand-icon{
display: none !important;
}
</style>
+20
View File
@@ -0,0 +1,20 @@
import XTbl, {Xtc} from '../../components/x-table/index';
const tbl = new XTbl('/admin/collection/table', 'لیست دسته بندی ها');
tbl.add(new Xtc('title', 'نام دسته').filterText());
tbl.add(new Xtc('parent.title', 'پدر دسته').filterText());
tbl.add(new Xtc('has_same_adv', 'نمایش آگهی های مرتبط').filterSwitch().renderSlot('same_adv'));
tbl.add(new Xtc('has_in_menu', 'دسته در منو').filterSwitch().renderSlot('menu'));
tbl.add(new Xtc('is_comparable', 'مقایسه').filterSwitch().hidden().renderSlot('comparable'));
tbl.add(new Xtc('has_comment', 'نظرات').filterSwitch().renderSlot('comment'));
tbl.add(new Xtc('is_count_view', 'نمایش بازدید ها').filterSwitch().renderSlot('view'));
tbl.add(new Xtc('count_adv', 'تعداد آگهی').filterNumber());
tbl.add(new Xtc('caj', 'تاریخ ساخت دسته').filterNumber().hidden());
tbl.add(new Xtc('', 'ناظران دسته').filterText().renderSlot('supervisors_item'));
tbl.add(new Xtc('icon', 'آیکن').renderSlot('icon'));
tbl.add(new Xtc('opt', 'عملیات').noSort().renderSlot('opt'));
export default tbl;