liuhj 7 months ago
parent
commit
613f38c569

+ 5 - 0
src/components/OP/OpInvitationOfficialActivities.vue

@@ -745,6 +745,11 @@ export default {
         },
         //点击保存事件
         addBtn() {
+            if(this.InvitationOfficialActivities.payDId!=72){
+                this.InvitationOfficialActivities.ctdId=0;
+                this.InvitationOfficialActivities.bankNo="";
+                this.InvitationOfficialActivities.cardholderName="";
+            }
             if (this.IsAuditGM == 1) {
                 this.$message.error('已通过审核,不可修改!');
             } else {

+ 511 - 30
src/components/OP/SuppliesInventory.vue

@@ -1,35 +1,174 @@
 <template>
     <div class="SuppliesInventory-all">
-        <div class="SuppliesInventory-head">
-            <div class="SuppliesInventory-head-li">
-                <label>物资类型:</label>
-                <el-select style="width:220px" @change="MaterialTypechange" v-model="MaterialType" clearable filterable
-                    placeholder="请选择">
-                    <el-option v-for="item in MaterialTypearr" :key="item.id" :label="item.name"
-                        :value="item.id">
-                    </el-option>
-                </el-select>
-            </div>
-            <div class="SuppliesInventory-head-li">
-                <label>物资详细类型:</label>
-                <el-select @change="MaterialinfoTypechange" style="width:220px" multiple collapse-tags v-model="MaterialinfoType" clearable filterable
-                    placeholder="请选择">
-                    <el-option v-for="item in MaterialinfoTypearr" :key="item.id" :label="item.name"
-                        :value="item.id">
-                    </el-option>
-                </el-select>
+        <el-dialog top="10vh
+        " width="1200px" title="入库物品" :visible.sync="warehousingsVisible">
+            <el-form :model="warehousingsruleForm" :rules="warehousingsrules" ref="warehousingsruleForm" label-width="100px" class="demo-ruleForm">
+                <div class="warehousingsrule-input">
+                    <el-form-item label="入库数量" prop="quantity">
+                        <el-input-number @blur="Sumup" size="small" :precision="2" :controls="false" v-model="warehousingsruleForm.quantity"></el-input-number>
+                    </el-form-item>
+                    <el-form-item label="物品单价" prop="unitPrice">
+                        <el-input-number @blur="Sumup" size="small" :precision="2" :controls="false" v-model="warehousingsruleForm.unitPrice"></el-input-number>
+                    </el-form-item>
+                    <el-form-item label="物品总价" prop="totalPrice">
+                        <el-input-number size="small" :precision="2" :controls="false" v-model="warehousingsruleForm.totalPrice"></el-input-number>
+                    </el-form-item>
+                    <el-form-item label="供应商名称" prop="supplierName">
+                        <el-input size="small" placeholder="请输入物资名称" v-model="warehousingsruleForm.supplierName" clearable></el-input>
+                    </el-form-item>
+                    <el-form-item label="供应商电话" prop="supplierTel">
+                        <el-input size="small" placeholder="请输入供应商电话" v-model="warehousingsruleForm.supplierTel" clearable></el-input>
+                    </el-form-item>
+                    <el-form-item label="供应商地址" prop="supplierAddress">
+                        <el-input size="small" placeholder="请输入供应商地址" v-model="warehousingsruleForm.supplierAddress" clearable></el-input>
+                    </el-form-item>
+                    <el-form-item label="供应商来源" prop="supplierSource">
+                        <el-input size="small" placeholder="请输入供应商来源" v-model="warehousingsruleForm.supplierSource" clearable></el-input>
+                    </el-form-item>
+                    <el-form-item style="width:66.5%;" label="备注" prop="remark">
+                        <el-input size="small" placeholder="请输入备注称" v-model="warehousingsruleForm.remark" clearable></el-input>
+                    </el-form-item>
+                </div>
+                <el-form-item style="text-align: right;">
+                    <el-button size="small" @click="resetForm('warehousingsruleForm')">清空</el-button>
+                    <el-button size="small" type="primary" @click="submitForm('warehousingsruleForm')">保存</el-button>
+                </el-form-item>
+                <div class="warehousingsrule-table">
+                    <el-table
+                        height="400"
+                        :data="warehousingslist"
+                        border
+                        style="width: 100%">
+                        <el-table-column
+                        prop="unitPrice"
+                        label="物品单价"
+                        width="80">
+                        <template slot-scope="scope">
+                            {{townum(scope.row.unitPrice)}}
+                        </template>
+                        </el-table-column>
+                        <el-table-column
+                        prop="quantity"
+                        label="物品数量"
+                        width="80">
+                        </el-table-column>
+                        <el-table-column
+                        prop="totalPrice"
+                        label="物品总价"
+                        width="80">
+                        <template slot-scope="scope">
+                            {{townum(scope.row.totalPrice)}}
+                        </template>
+                        </el-table-column>
+                        <el-table-column
+                        prop="supplierName"
+                        label="供应商名称"
+                        width="180">
+                        </el-table-column>
+                        <el-table-column
+                        prop="supplierTel"
+                        label="供应商电话">
+                        </el-table-column>
+                        <el-table-column
+                        prop="supplierAddress"
+                        label="供应商地址">
+                        </el-table-column>
+                        <el-table-column
+                        prop="supplierSource"
+                        label="供应商来源">
+                        </el-table-column>
+                        <el-table-column 
+                        label="操作"
+                        width="155">
+                        <template slot-scope="scope">
+                            <el-button size="mini" title="编辑">编辑</el-button>
+                            <el-button size="mini" title="删除" type="danger" @click="Deleteintolibrary(scope.row)">删除</el-button>
+                        </template>
+                        </el-table-column>
+                    </el-table>
+                </div>
+            </el-form>
+        </el-dialog>
+        <el-dialog title="添加物品" :visible.sync="AddItemsVisible">
+            <div class="additems-ul">
+                <div class="additems-li">
+                    <label>物资类型:</label>
+                    <el-select style="width:220px" @change="AddMaterialTypechange(0)" v-model="AddMaterialType" clearable filterable
+                        placeholder="请选择">
+                        <el-option v-for="item in AddMaterialTypearr" :key="item.id" :label="item.name"
+                            :value="item.id">
+                        </el-option>
+                    </el-select>
+                </div>
+                <div class="additems-li">
+                    <label>物资详细类型:</label>
+                    <el-select style="width:220px" v-model="AddMaterialinfoType" clearable filterable
+                        placeholder="请选择">
+                        <el-option v-for="item in AddMaterialinfoTypearr" :key="item.id" :label="item.name"
+                            :value="item.id">
+                        </el-option>
+                    </el-select>
+                </div>
+                <div class="additems-li">
+                    <label>物资名称:</label>
+                    <el-input
+                    style="width:220px"
+                    placeholder="请输入物资名称"
+                    v-model="AdditemsName"
+                    clearable>
+                    </el-input>
+                </div>
             </div>
-            <div class="SuppliesInventory-head-li">
-                <label>物资名称:</label>
+            <div>
+                <label>备注:</label>
                 <el-input
-                style="width:220px"
+                style="width:100%;"
+                type="textarea"
+                :autosize="{ minRows: 2, maxRows: 4}"
                 placeholder="请输入内容"
-                v-model="Materialname"
-                clearable>
+                v-model="Additemstextarea">
                 </el-input>
             </div>
-            <div class="SuppliesInventory-head-li">
-                <el-button @click="GoodsList" type="primary">查 询</el-button>
+            <div class="additems-btn">
+                <el-button @click="AddItemsVisible=false">取消</el-button>
+                <el-button @click="GoodsOP" type="primary">保存</el-button>
+            </div>
+        </el-dialog>
+        <div class="SuppliesInventory-head">
+            <div class="SuppliesInventory-head-ul">
+                <div class="SuppliesInventory-head-li">
+                    <label>物资类型:</label>
+                    <el-select style="width:220px" @change="MaterialTypechange" v-model="MaterialType" clearable filterable
+                        placeholder="请选择">
+                        <el-option v-for="item in MaterialTypearr" :key="item.id" :label="item.name"
+                            :value="item.id">
+                        </el-option>
+                    </el-select>
+                </div>
+                <div class="SuppliesInventory-head-li">
+                    <label>物资详细类型:</label>
+                    <el-select @change="MaterialinfoTypechange" style="width:220px" multiple collapse-tags v-model="MaterialinfoType" clearable filterable
+                        placeholder="请选择">
+                        <el-option v-for="item in MaterialinfoTypearr" :key="item.id" :label="item.name"
+                            :value="item.id">
+                        </el-option>
+                    </el-select>
+                </div>
+                <div class="SuppliesInventory-head-li">
+                    <label>物资名称:</label>
+                    <el-input
+                    style="width:220px"
+                    placeholder="请输入内容"
+                    v-model="Materialname"
+                    clearable>
+                    </el-input>
+                </div>
+                <div class="SuppliesInventory-head-li">
+                    <el-button @click="GoodsList" type="primary">查 询</el-button>
+                </div>
+            </div>
+            <div>
+                <el-button @click="addbtnclick" type="primary">新增物品</el-button>
             </div>
         </div>
         <div class="SuppliesInventory-table">
@@ -68,7 +207,12 @@
                 </el-table-column>
                 <el-table-column
                 label="操作"
-                width="180">
+                width="220">
+                    <template slot-scope="scope">
+                        <el-button size="mini" title="编辑" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
+                        <el-button size="mini" @click="instorage(scope.row)" type="primary">入库</el-button>
+                        <el-button size="mini" title="删除" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
+                    </template>
                 </el-table-column>
             </el-table>
         </div>
@@ -78,6 +222,8 @@
 export default {
     data() {
         return {
+            Userid:'',
+            token:"",
             MaterialType:'',
             MaterialTypearr:[],
             MaterialinfoType:[],
@@ -85,9 +231,63 @@ export default {
             MaterialinfoTypearr:[],
             Materialname:'',
             tableData:[],
+            AddItemsVisible:false,
+            //新增物品参数
+            AddMaterialType:"",
+            AddMaterialTypearr:[],
+            AddMaterialinfoType:"",
+            AddMaterialinfoTypearr:[],
+            AdditemsName:"",
+            Additemstextarea:"",
+            ID:0,
+            //入库参数
+            warehousingslist:[],
+            warehousingsVisible:false,
+            warehousingsruleForm: {
+                id:0,
+                quantity: 0,
+                unitPrice: 0,
+                totalPrice: 0,
+                supplierName: '',
+                supplierTel: '',
+                supplierAddress: '',
+                supplierSource: '',
+                remark: ''
+            },
+            warehousingsrules: {
+                quantity: [
+                    { required: true, message: '请输入', trigger: 'blur' },
+                ],
+                unitPrice: [
+                    { required: true, message: '请输入', trigger: 'blur' },
+                ],
+                totalPrice: [
+                    { required: true, message: '请输入', trigger: 'blur' },
+                ],
+                supplierName: [
+                    { required: true, message: '请输入', trigger: 'blur' },
+                ],
+                supplierTel: [
+                    { required: true, message: '请输入', trigger: 'blur' },
+                ],
+                supplierAddress: [
+                    { required: true, message: '请输入', trigger: 'blur' },
+                ],
+                supplierSource: [
+                    { required: true, message: '请输入', trigger: 'blur' },
+                ],
+                remark: [
+                    { required: true, message: '请输入', trigger: 'blur' },
+                ],
+            }
         }
     },
     methods:{
+        //保留两位小数
+        townum(val){
+            val=Number(val);
+            return val.toFixed(2);
+        },
         //获取
         GoodsInitDataSource() {
             var url = "/api/PersonnelModule/GoodsInitDataSource"
@@ -101,6 +301,7 @@ export default {
             }).then(function (res) {
                 if (res.data.code == 200) {
                     that.MaterialTypearr=res.data.data.goodsTypeData;
+                    that.AddMaterialTypearr=res.data.data.goodsTypeData;
                     that.MaterialType=that.MaterialTypearr[0].id;
                     that.MaterialTypechange();
                 } else {
@@ -110,8 +311,6 @@ export default {
         },
         //物资类型切换
         MaterialTypechange(){
-            console.log(this.MaterialType);
-            console.log(this.MaterialTypearr);
             this.MaterialinfoType="";
             this.MaterialinfoTypearr=[];
             for(let i=0;i<this.MaterialTypearr.length;i++){
@@ -127,7 +326,18 @@ export default {
                 this.MaterialinfoTypes+=this.MaterialinfoType[i]+','
             }
             this.MaterialinfoTypes=this.MaterialinfoTypes.substring(0, this.MaterialinfoTypes.length - 1);
-            console.log(this.MaterialinfoTypes);
+        },
+        //add物资类型切换
+        AddMaterialTypechange(val){
+            if(val==0){
+                this.AddMaterialinfoType="";
+            }
+            this.AddMaterialinfoTypearr=[];
+            for(let i=0;i<this.AddMaterialTypearr.length;i++){
+                if(this.AddMaterialType==this.AddMaterialTypearr[i].id){
+                    this.AddMaterialinfoTypearr=this.AddMaterialTypearr[i].subTypeItems;
+                }
+            }
         },
         //获取列表
         GoodsList() {
@@ -151,11 +361,242 @@ export default {
                     that.tableData=res.data.data;
                 }
             }).catch(function (error) {
-                that.$message.error("获取团组失败");
+                that.$message.error("操作错误,联系信息部!");
             });
         },
+        //新增按钮
+        addbtnclick(){
+            this.ID=0;
+            this.AdditemsName="";
+            this.AddMaterialType="";
+            this.AddMaterialinfoType="";
+            this.Additemstextarea="";
+            this.AddItemsVisible=true;
+        },
+        //编辑
+        handleEdit(index,row){
+            console.log(row);
+            this.ID=row.id;
+            var url = "/api/PersonnelModule/GoodsInfo?portType=1&id="+this.ID
+            var that = this
+            this.$axios({
+                method: 'get',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' 
+                }
+            }).then(function (res) {
+                if (res.data.code == 200) {
+                    var datainfo=res.data.data;
+                    that.Additemstextarea=datainfo.remark;
+                    that.AdditemsName=datainfo.name;
+                    that.AddMaterialType=datainfo.parentType;
+                    that.AddMaterialinfoType=datainfo.type;
+                    that.AddItemsVisible=true;
+                    that.AddMaterialTypechange(2);
+                }else{
+                    that.$message.error(res.data.msg);
+                }
+            }).catch(function (error) {
+                that.$message.error("操作错误,联系信息部!");
+            });
+        },
+        //删除
+        handleDelete(index,row){
+            this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
+                confirmButtonText: '确定',
+                cancelButtonText: '取消',
+                type: 'warning'
+            }).then(() => {
+                var url = "/api/PersonnelModule/GoodsDel/"+row.id
+                var that = this
+                this.$axios({
+                    method: 'delete',
+                    url: url,
+                    headers: {
+                        Authorization: 'Bearer ' +that.token
+                    }
+                }).then(function (res) {
+                    if (res.data.code == 200) {
+                        that.$message({
+                            type: 'success',
+                            message: res.data.msg
+                        });
+                        that.GoodsList();
+                    }else{
+                        that.$message.error(res.data.msg);
+                    }
+                }).catch(function (error) {
+                    that.$message.error("操作错误,联系信息部!");
+                });
+                
+            }).catch(() => {
+                this.$message({
+                    type: 'info',
+                    message: '已取消删除'
+                });          
+            });
+        },
+        //计算总价
+        Sumup(){
+            console.log(123);
+            this.warehousingsruleForm.totalPrice=this.warehousingsruleForm.quantity*this.warehousingsruleForm.unitPrice;
+        },
+        //新增物品api
+        GoodsOP() {
+            var url = "/api/PersonnelModule/GoodsOP"
+            var that = this
+            if (that.AdditemsName==""||that.AddMaterialinfoType==""||that.Additemstextarea=="") {
+                that.$message.error("检查是否填写完全!");
+                return
+            }
+            this.$axios({
+                method: 'post',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' +that.token
+                },
+                data: {
+                    currUserId:that.Userid,
+                    id:that.ID,
+                    name:that.AdditemsName,
+                    type:that.AddMaterialinfoType,
+                    remark:that.Additemstextarea,
+                }
+            }).then(function (res) {
+                if (res.data.code == 200) {
+                    that.$message({
+                        message:res.data.msg ,
+                        type: 'success',
+                        offset:50
+                    });
+                    that.AddItemsVisible=false;
+                    that.GoodsList();
+                }else{
+                    that.$message.error(res.data.msg);
+                }
+            }).catch(function (error) {
+                that.$message.error("操作错误,联系信息部!");
+            });
+        },
+        //入库列表
+        instorage(row){
+            this.ID=row.id;
+            this.warehousingsVisible=true;
+            var url = "/api/PersonnelModule/GoodsStorageList"
+            var that = this
+            this.$axios({
+                method: 'POST',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' 
+                },
+                data:{
+                    portType:1,
+                    pageIndex:1,
+                    pageSize:10,
+                    goodsId:row.id,
+                }
+            }).then(function (res) {
+                if (res.data.code == 200) {
+                    that.warehousingslist=res.data.data;
+                }else{
+                    that.$message.error(res.data.msg);
+                }
+            }).catch(function (error) {
+                that.$message.error("操作错误,联系信息部!");
+            });
+        },
+        //入库api
+        GoodsStorageOP(){
+            var url = "/api/PersonnelModule/GoodsStorageOP"
+            var that = this
+            this.$axios({
+                method: 'POST',
+                url: url,
+                headers: {
+                    Authorization: 'Bearer ' +that.token
+                },
+                data:{
+                    id:that.warehousingsruleForm.id,
+                    goodsId:that.ID,
+                    quantity:that.warehousingsruleForm.quantity,
+                    unitPrice:that.warehousingsruleForm.unitPrice,
+                    totalPrice:that.warehousingsruleForm.totalPrice,
+                    supplierName:that.warehousingsruleForm.supplierName,
+                    supplierTel:that.warehousingsruleForm.supplierTel,
+                    supplierAddress:that.warehousingsruleForm.supplierAddress,
+                    supplierSource:that.warehousingsruleForm.supplierSource,
+                    remark:that.warehousingsruleForm.remark,
+                }
+            }).then(function (res) {
+                if (res.data.code == 200) {
+                    that.$message({
+                        message:res.data.msg ,
+                        type: 'success'
+                    });
+                    that.instorage({'id':that.ID});
+                }else{
+                    that.$message.error(res.data.msg);
+                }
+            }).catch(function (error) {
+                that.$message.error("操作错误,联系信息部!");
+            });
+        },
+        //删除入裤
+        Deleteintolibrary(row){
+            this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
+                confirmButtonText: '确定',
+                cancelButtonText: '取消',
+                type: 'warning'
+            }).then(() => {
+                var url = "/api/PersonnelModule/GoodsStorageDel/"+row.id
+                var that = this
+                this.$axios({
+                    method: 'delete',
+                    url: url,
+                    headers: {
+                        Authorization: 'Bearer ' +that.token
+                    }
+                }).then(function (res) {
+                    if (res.data.code == 200) {
+                        that.$message({
+                            type: 'success',
+                            message: res.data.msg
+                        });
+                        that.instorage({'id':that.ID});
+                    }else{
+                        that.$message.error(res.data.msg);
+                    }
+                }).catch(function (error) {
+                    that.$message.error("操作错误,联系信息部!");
+                });
+                
+            }).catch(() => {
+                this.$message({
+                    type: 'info',
+                    message: '已取消删除'
+                });          
+            });
+        },
+        //
+        submitForm(formName) {
+            this.$refs[formName].validate((valid) => {
+            if (valid) {
+                this.GoodsStorageOP();
+            } else {
+                console.log('error submit!!');
+                return false;
+            }
+            });
+        },
+        resetForm(formName) {
+            this.$refs[formName].resetFields();
+        }
     },
     mounted(){
+        this.Userid=JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
+        this.token=JSON.parse(localStorage.getItem('userinif')).token;
         this.GoodsInitDataSource();
     }
 }
@@ -171,6 +612,7 @@ export default {
 }
 .SuppliesInventory-head{
     display: flex;
+    justify-content: space-between;
 }
 .SuppliesInventory-head-li{
     margin-right: 15px;
@@ -182,4 +624,43 @@ export default {
 .SuppliesInventory-table{
     margin-top: 15px;
 }
+.SuppliesInventory-head-ul{
+    display: flex;
+}
+.additems-ul{
+    display: flex;
+    justify-content: space-between;
+    flex-wrap: wrap;
+}
+.additems-li{
+    margin-bottom: 10px;
+}
+.additems-btn{
+    text-align: right;
+    margin-top: 20px;
+}
+.warehousingsrule-input{
+    display: flex;
+    flex-wrap: wrap;
+    justify-content: space-between;
+}
+.warehousingsrule-input .el-form-item{
+    width: 33%;
+}
+.warehousingsrule-input .el-input-number{
+    width: 100%;
+}
+.warehousingsrule-input .el-form-item{
+    margin-bottom: 10px;
+}
+.warehousingsrule-input .el-form-item__error{
+    top: 82%;
+}
+.warehousingsrule-table .all-box .el-table th.el-table__cell>.cell{
+    text-align: center;
+    font-size: 12px;
+}
+.warehousingsrule-table .el-table td.el-table__cell div{
+    font-size: 12px;
+}
 </style>