huk 3 年之前
父节点
当前提交
0350b8ff88
共有 4 个文件被更改,包括 99 次插入49 次删除
  1. 2 2
      build/utils.js
  2. 2 1
      config/index.js
  3. 69 27
      src/views/RMS/components/addOilPrice.vue
  4. 26 19
      src/views/RMS/components/oilPrice.vue

+ 2 - 2
build/utils.js

@@ -15,8 +15,8 @@ const devPathSrc = path.resolve(__dirname, '../../../src'); // node_modules应
 // ['index','appoint','configManager','homepage','inward','queue','RMS','sale','serviceManager','SporadicManage'
 //       统计报表       组织机构/系统管理 采购  仓储
 //  'statisticalReport','systemConfig','TMS','WMS','workFlow']
-let devModules = ['all'];
-// let devModules = ['index','statisticalReport','appoint','RMS'];
+// let devModules = ['all'];
+let devModules = ['index','statisticalReport','appoint','RMS'];
 if (pathSrc.indexOf('node_modules') > -1) {
     devModules = require('../../../cors.js').devModules;
 }

+ 2 - 1
config/index.js

@@ -65,7 +65,8 @@ let proxyTable = {
     }
   },
   "/views/api/v1": {
-    target: "http://172.16.33.166:8080",
+    // target: "http://172.16.33.166:8080",
+    target: "http://192.168.1.102:8019",
     ws: true,
     pathRewrite: {
       "^/views/api/v1": "/api/v1"

+ 69 - 27
src/views/RMS/components/addOilPrice.vue

@@ -2,11 +2,20 @@
   <!-- 添加油价信息 -->
   <div class="addWagonLoad">
     <page-title>返回</page-title>
+    <div class="form_you">
+      <span class="text">油品名称 </span>
+      <el-select v-model="oilNameId" filterable placeholder="请选择">
+        <el-option
+          v-for="item in options"
+          :key="item.value"
+          :label="item.label"
+          :value="item.value">
+        </el-option>
+      </el-select>
+      <el-button type="primary" @click="dialogVisible = true">新增油品名称</el-button>
+    </div>
     <div class="form_box" style="margin-right: 10rem">
       <dil-form :formId="357" v-model="form1" ref="from1" @change="onchang"></dil-form>
-      <div class="addbtn">
-        <el-button type="primary" @click="dialogVisible = true">新增油品名称</el-button>
-      </div>
     </div>
     <div class="button_box">
       <el-button @click="cancel">取消</el-button>
@@ -17,9 +26,10 @@
       :visible.sync="dialogVisible"
       width="30%"
     >
+      <span>注:<span style="color:red;">不能输入特殊符号('#')</span></span>
       <el-input v-model="input" placeholder="请输入内容"></el-input>
       <span slot="footer" class="dialog-footer">
-        <el-button @click="dialogCancel">取 消</el-button>
+        <el-button @click="dialogVisible = false">取 消</el-button>
         <el-button type="primary" @click="dialogMakeSure">确 定</el-button>
       </span>
     </el-dialog>
@@ -28,60 +38,80 @@
 
 <script>
 import PageTitle from "@/components/Page/Title";
-import { isNumber } from '@/utils/sharedJsFile'
+import { isNumber,sjTime } from '@/utils/sharedJsFile'
 export default {
   components: { PageTitle },
   data() {
     return {
-      isagain:false,
+      //下拉框选中的值
+      oilNameId:null,
+      //加载状态
       loading:false,
+      //油品名称新增的值
       input:null,
+      //是否显示添加油品名称的窗口
       dialogVisible:false,
+      //下拉框的数据
+      options:[],
+      //表单的数据
       form1: {
-        priceOilName:'',
         priceValue:'',
         priceDate:new Date(),
-        enableStatus:false,
+        priceStatus:false,
       },
     };
   },
+  created(){
+    this.initialization();
+  },
   methods: {
-    dialogCancel(){
-
+    initialization(){
+      this.axios.post('/api/v1/rms/oilNameSelect').then((res)=>{
+        if(res.data.code == "200"){
+          this.options = res.data.data;
+        }
+      })
     },
     onchang(val){
-      if(val.enableStatus){
-        this.$message.warning('确认启用后将停用现在正在执行的油品价格')
+      if(val.priceStatus){
+        this.$message.warning('确认启用后将停用正在执行的油品价格')
       }
     },
     dialogMakeSure(){
-      // this.loading = true;
-      // if(this.input){
-      //   this.axios.post('',{text:this.input}).then((res)=>{
-      //     if(res.data.code == "200"){
-      //       this.loading = false;
-      //       this.$message.success('新增成功')
+      this.loading = true;
+      if(this.input){
+        this.axios.post('/api/v1/rms/addOilType?oilTypeName='+this.input).then((res)=>{
+          if(res.data.code == "200"){
+            this.loading = false;
+            this.$message.success('新增成功')
             this.dialogVisible = false;
-      //     }
-      //   })
-      // }else{
-      //   this.$message.warning('请输入油品名称')
-      // } 
+            this.initialization();
+          }
+        })
+      }else{
+        this.$message.warning('请输入油品名称')
+      } 
     },
     makeSure() {
       this.loading = true;
       let state = false;
-      if(!this.form1.priceOilName){
+      if(!this.oilNameId){
         this.$message.warning('请填写油品名称')
       }else if(!this.form1.priceValue){
         this.$message.warning('请填写油品价格')
       }else if(!isNumber(this.form1.priceValue)){
         this.$message.warning('油品价格必修为整数或者小数')
       }else{
-        // state = true;            
+        state = true;            
       }
       if(state){
-        let RmsOilPrice = this.form1;
+        let RmsOilPrice = {
+          oilNameId:this.oilNameId,
+          priceValue:this.form1.priceValue,
+          priceDate:sjTime(this.form1.priceDate),
+          priceStatus:this.form1.priceStatus
+        };
+        console.log(RmsOilPrice);
         this.axios.post("/api/v1/rms/insertOilPrice" , RmsOilPrice)
         .then((res) => {
           if (res.data.code == "200") {
@@ -103,9 +133,21 @@ export default {
 </script>
 <style lang='scss'>
 .addWagonLoad{
+  .form_you{
+    margin-left: 35%;
+    margin-top: 30px;
+    .text{
+      display: inline-block;
+      width: 55px;
+    }
+    .el-select{
+      width: 250px;
+      margin-right: 20px;
+    }
+  }
   .form_box{
     margin-left: 35%;
-    padding-top: 30px;
+    padding-top: 10px;
     width: 470px;
     display: flex;
     .el-form{

+ 26 - 19
src/views/RMS/components/oilPrice.vue

@@ -7,7 +7,7 @@
         v-model="textInput"
         clearable>
       </el-input>
-      <el-button type="primary" class="btn1"  @click="onclick" :loading="loading">
+      <el-button type="primary" class="btn1"  @click="onclick" :loading="selectLoading">
         <i class="el-icon-search"></i>查询
       </el-button>
       <el-button type="primary" class="btn" @click="toInsert">
@@ -19,7 +19,7 @@
         v-bind.sync="options"
         :isKuang="isKuang"
         @func="func"
-        :loading="loading"
+        :loading="tableLoading"
       >
         <el-table-column fixed="right" label="操作" width="100">
           <template slot-scope="scope">
@@ -27,7 +27,7 @@
               type="text"
               size="small"
               @click="onEnable(scope)"
-              v-if="enableStatus"
+              v-if="scope.row.priceStatus !== '启用'"
             >
               启用
             </el-button>
@@ -39,13 +39,6 @@
             >
               停用
             </el-button>
-            <el-button
-              type="text"
-              size="small"
-              @click="updateOilPrice(scope)"
-            >
-              修改
-            </el-button>
             <el-button
               type="text"
               size="mini"
@@ -64,7 +57,8 @@ export default {
   name:"homeworkPath",
   data(){
     return{
-      loading:false,
+      tableLoading:false,
+      selectLoading:false,
       isKuang:false,
       //切换是否启用按钮和停用按钮
       enableStatus:true,
@@ -78,13 +72,16 @@ export default {
   },
   methods:{
     func(res){
-      console.log(res);
+      if(this.selectLoading){
+        this.selectLoading = false;
+      }
       this.isKuang = false;
-      this.loading = false;
+      this.tableLoading = false;
     },
     onclick(){
       this.isKuang = true;
-      this.loading = true;
+      this.selectLoading = true;
+      this.tableLoading = true;
       if(this.textInput){
         this.options.requestUrl = "/api/v1/rms/getOilPriceResultList?apiId=380&con=" +this.textInput+"&i="+ new Date();
       }else{
@@ -95,12 +92,22 @@ export default {
     toInsert() {
       this.$router.push("/addOilPrice");
     },
-    /*这里要改一改*/
-    updateOilPrice(scope){
-      this.$router.push("/editOilPrice/"+scope.row.priceId)
-    },
     deleteOilPrice(scope){
-      console.log(scope)
+     this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.tableLoading = true;
+        this.axios.post('/api/v1/rms/deleteOilPrice/'+scope.row.priceId).then((res)=>{
+          if(res.data.code == "200"){
+            this.$message.success('删除成功')
+            this.options.requestUrl = "/api/v1/rms/getOilPriceResultList?apiId=380&i="+ new Date();
+          }
+        })
+      }).catch(() => {
+        this.$message.info('已取消删除');       
+      });
     },
   },
 }