codeMan 2 yıl önce
ebeveyn
işleme
b01c40d3c6

+ 30 - 0
src/HDrpManagement/unit/components/delete.vue

@@ -0,0 +1,30 @@
+<template>
+  <div style="display:inline;margin:0 16px">
+    <el-popconfirm title="确定删除当前数据吗?" @confirm="deleteRow()">
+      <el-button slot="reference" size="small" type="text">删 除</el-button>
+    </el-popconfirm>
+  </div>
+</template>
+
+<script>
+export default {
+  props: ['type','id'],
+  methods: {
+    async deleteRow() {
+      let res = await this.$api.requested({
+          "id": this.type == 'unit' ? '20220922084903' : '20220922084603',
+          "version":1,
+          "content": {
+            [this.type == 'unit' ? 'unitid' : 'unitgroupid']:this.id
+          }
+      })
+
+      console.log(res);
+      this.tool.showMessage(res,() => {
+        this.$emit('deleteSuccess')
+      })
+    },
+  }
+}
+
+</script>

+ 91 - 0
src/HDrpManagement/unit/components/list.vue

@@ -0,0 +1,91 @@
+<template>
+  <div class="unit container normal-panel">
+    <el-row>
+      <el-col :span="11">
+        <p class="normal-title normal-margin">计量单位</p>
+        <slot name="unitAdd"/>
+        <tableLayout v-if="unitList" :layout="tablecols1" :data="unitList" :custom="false" height="70vh">
+          <template v-slot:opreation="scope">
+              <div style="display:flex">
+                  <slot name="unitEdit" :data="scope.data" />
+                  <slot name="unitDel" :data="scope" />
+              </div>
+          </template>
+        </tableLayout>
+      </el-col>
+      <el-col :span="11" style="margin-left:16px">
+        <p class="normal-title normal-margin">计量单位组</p>
+        <slot name="unitGroupAdd"/>
+        <tableLayout v-if="unitGroupList" :layout="tablecols2" :data="unitGroupList" :custom="false" height="70vh">
+          <template v-slot:opreation="scope">
+              <div style="display:flex">
+                  <slot name="unitGroupEdit" :data="{row:scope.data,unitList:unitList}" />
+                  <slot name="unitGroupDel" :data="scope.data" />
+              </div>
+          </template>
+        </tableLayout>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+export default {
+  name: '',
+  data() {
+    return {
+      unitList:'',
+      unitGroupList:'',
+      tablecols1:'',
+      tabelCol2:''
+    };
+  },
+  computed:{
+  },
+  watch:{
+  },
+  created() {
+    this.getUnit()
+    this.getUnitGroup()
+    this.tablecols1 = this.tool.tabelCol(this.$route.name).unitTable.tablecols
+    this.tablecols2 = this.tool.tabelCol(this.$route.name).unitGroupTable.tablecols
+  },
+  methods: {
+    /* 获取单位列表 */
+    async getUnit() {
+      let res = await this.$api.requested({
+        "id": "20220922084803",
+        "version":1,
+        "content": {
+          "nocache":true,
+          "where":{
+              "condition":""
+          }
+        }
+      })
+      this.unitList = res.data
+      console.log(res)
+    },
+    /* 计量单位组数据 */
+    async getUnitGroup() {
+      let res = await this.$api.requested({
+        "id": "20220922084503",
+        "version":1,
+        "content": {
+          "nocache":true,
+          "where":{
+              "condition":""
+          }
+        }
+      })
+      this.unitGroupList = res.data
+      console.log(res);
+      
+    }
+  },
+};
+</script>
+
+<style scoped>
+
+</style>

+ 99 - 0
src/HDrpManagement/unit/components/unitAdd.vue

@@ -0,0 +1,99 @@
+<template>
+  <div class="add">
+    <el-button type="primary" size="small" style="margin-bottom:16px" @click="dialogVisible=true" v-if="type=='add'">新增</el-button>
+    <el-button type="text" size="small" @click="editBtn" v-else>编辑</el-button>
+    <el-dialog
+      :title="type == 'add' ? '新增计量单位' : '编辑计量单位'"
+      :visible.sync="dialogVisible"
+      width="30%"
+      :before-close="handleClose">
+      <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
+        <el-form-item label="计量单位" prop="unitname">
+          <el-input v-model="ruleForm.unitname" size="small"></el-input>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <div>
+          <el-button @click="dialogVisible = false" size="small">取 消</el-button>
+          <el-button type="primary" @click="submit" size="small">确 定</el-button>
+        </div>
+      </span>
+    </el-dialog>
+  </div>
+  
+</template>
+
+<script>
+import { log } from '@antv/g2plot/lib/utils';
+export default {
+  name: '',
+  data() {
+    return {
+      currentData:'',
+      dialogVisible:false,
+      ruleForm: {
+        unitname:''
+      },
+      rules:{
+        unitname: [
+          { required: true, message: '请输入计量单位', trigger: 'blur' },
+        ]
+      }
+    };
+  },
+  props:['type','unitData'],
+  computed:{
+  },
+  watch:{
+    currentData: {
+      handler(val) {
+        this.ruleForm.unitname = val.unitname
+      }
+    }
+  },
+  methods: {
+    editBtn() {
+      this.dialogVisible=true
+      this.currentData = this.unitData
+    },
+    handleClose() {
+      this.dialogVisible = false
+    },
+    submit() {
+      this.$refs.ruleForm.validate(async val => {
+        if(val) {
+          let res = await this.$api.requested({
+            "accesstoken": "bed2f4500c0e799a29ddbbe47a2a04b6",
+            "id": "20220922084703",
+            "version":1,
+            "content": {
+                "unitid":this.type == 'add' ? 0 : this.currentData.unitid,
+                "unitname":this.ruleForm.unitname
+            }
+          })
+          console.log(res);
+          this.tool.showMessage(res,() => {
+            this.$emit('unitAddSuccess')
+            this.dialogVisible = false
+            this.$refs.ruleForm.resetFields()
+          })
+        }
+      })
+    }
+  },
+};
+</script>
+
+<style scoped>
+  .dialog-footer {
+    display: flex;
+    justify-content: space-evenly;
+  }
+  /deep/.el-dialog__body {
+    padding-top: 10px !important;
+    padding-bottom: 0 !important;
+  }
+  /deep/.dialog-footer {
+    margin-top: 10px !important;
+  }
+</style>

+ 147 - 0
src/HDrpManagement/unit/components/unitGroupAdd.vue

@@ -0,0 +1,147 @@
+<template>
+  <div class="add">
+    <el-button type="primary" size="small" style="margin-bottom:16px" @click="dialogVisible=true" v-if="type=='add'">新增</el-button>
+    <el-button type="text" size="small" @click="editBtn" v-else>编辑</el-button>
+    <el-dialog
+      :title="type == 'add' ? '新增计量单位组' : '编辑计量单位组'"
+      :visible.sync="dialogVisible"
+      width="30%"
+      :before-close="handleClose">
+      <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" class="demo-ruleForm">
+        <el-form-item label="计量单位组名称" prop="unitgroupname">
+          <el-input v-model="ruleForm.unitgroupname" size="small"></el-input>
+        </el-form-item>
+        <el-form-item label="主计量单位" prop="unitid">
+          <el-select v-model="ruleForm.unitid" placeholder="请选择">
+            <el-option
+              v-for="item in allUnit"
+              :key="item.value"
+              :label="item.unitname"
+              :value="item.unitid"
+              size="small">
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="辅助计量单位" prop="auxunitid">
+          <el-select v-model="ruleForm.auxunitid" placeholder="请选择">
+            <el-option
+              v-for="item in allUnit"
+              :key="item.value"
+              :label="item.unitname"
+              :value="item.unitid"
+              size="small">
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="换算率" prop="conversionrate">
+          <el-input v-model.number="ruleForm.conversionrate" size="small" placeholder="换算率=辅助单位数量/主单位数量"></el-input>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <div>
+          <el-button @click="dialogVisible = false" size="small">取 消</el-button>
+          <el-button type="primary" @click="submit" size="small">确 定</el-button>
+        </div>
+      </span>
+    </el-dialog>
+  </div>
+  
+</template>
+
+<script>
+import { log } from '@antv/g2plot/lib/utils';
+export default {
+  name: '',
+  data() {
+    return {
+      currentData:'',
+      dialogVisible:false,
+      ruleForm: {
+        unitgroupname:'',
+        unitid:'',
+        auxunitid:'',
+        conversionrate:''
+      },
+      rules:{
+        unitgroupname: [
+          { required: true, message: '请输入计量单位组名称', trigger: 'blur' },
+        ],
+        unitid: [
+          { required: true, message: '请输入主计量单位', trigger: 'blur' },
+        ],
+        auxunitid: [
+          { required: true, message: '请输入辅助计量单位', trigger: 'blur' },
+        ],
+        conversionrate: [
+          { required: true, message: '请输入换算率,换算率=辅助单位数量/主单位数量', trigger: 'blur' },
+          { message: '换算率必须为数字', trigger: 'blur' , type:'number' },
+        ],
+      }
+    };
+  },
+  props:['type','unitData','allUnit'],
+  computed:{
+  },
+  watch:{
+    currentData: {
+      handler(val) {
+        this.ruleForm = {
+          unitgroupname:val.unitgroupname,
+          unitid:val.unitid,
+          auxunitid:val.auxunitid,
+          conversionrate:val.conversionrate
+        }
+      }
+    }
+  },
+  methods: {
+    editBtn() {
+      this.dialogVisible=true
+      this.currentData = this.unitData
+    },
+    handleClose() {
+      this.dialogVisible = false
+    },
+    submit() {
+      this.$refs.ruleForm.validate(async val => {
+        if(val) {
+          let res = await this.$api.requested({
+            "id": "20220922084403",
+            "version":1,
+            "content": {
+              "unitgroupid":this.type == 'add' ? 0 : this.unitData.unitgroupid,     
+              "unitgroupname":this.ruleForm.unitgroupname,
+              "unitid":this.ruleForm.unitid,
+              "auxunitid":this.ruleForm.auxunitid,
+              "conversionrate":this.ruleForm.conversionrate
+            }
+          })
+          console.log(res);
+          this.tool.showMessage(res,() => {
+            this.$emit('unitAddSuccess')
+            this.dialogVisible = false
+            this.$refs.ruleForm.resetFields()
+          })
+        }
+      })
+    }
+  },
+};
+</script>
+
+<style scoped>
+  .dialog-footer {
+    display: flex;
+    justify-content: space-evenly;
+  }
+  /deep/.el-dialog__body {
+    padding-top: 10px !important;
+    padding-bottom: 0 !important;
+  }
+  /deep/.dialog-footer {
+    margin-top: 10px !important;
+  }
+  /deep/.el-select {
+    width: 100% !important;
+  }
+</style>

+ 112 - 0
src/HDrpManagement/unit/index.vue

@@ -0,0 +1,112 @@
+<template>
+  <div>
+    <list ref="list">
+      <!--单位计量-->
+      <unitAdd 
+        type="add" 
+        slot="unitAdd" 
+        @unitAddSuccess="unitAddSuccess" 
+        v-if="tool.checkAuth($route.name,'insert')" 
+      />
+      <template v-slot:unitEdit="scope">
+        <unitAdd 
+          type="edit"  
+          @unitAddSuccess="unitAddSuccess" 
+          :unitData="scope.data" 
+          v-if="tool.checkAuth($route.name,'update')" 
+        />
+      </template>
+      <template v-slot:unitDel="scope">
+        <Del type="unit" 
+          @deleteSuccess="UnitDeleteSuccess" 
+          :id="scope.data.data.unitid"  
+          v-if="tool.checkAuth($route.name,'delete')"
+        />
+      </template>
+      <!--单位计量组-->
+      <unit-group-add 
+        type="add" 
+        slot="unitGroupAdd" 
+        @unitAddSuccess="unitGroupAddSuccess" 
+        :allUnit="unitList" 
+        v-if="tool.checkAuth($route.name,'insert')" 
+      />
+      <template v-slot:unitGroupEdit="scope">
+        <unit-group-add 
+          type="edit" 
+          :unitData="scope.data.row" 
+          @unitAddSuccess="unitGroupAddSuccess" 
+          :allUnit="scope.data.unitList" 
+          v-if="tool.checkAuth($route.name,'update')"
+        />
+      </template>
+      <template v-slot:unitGroupDel="scope">
+        <Del type="unitGroup" 
+          @deleteSuccess="unitGroupDelSuccess" 
+          :id="scope.data.unitgroupid" 
+          v-if="tool.checkAuth($route.name,'delete')"
+        />
+      </template>
+    </list>
+  </div>
+</template>
+
+<script>
+import list from './components/list'
+import Del from './components/delete'
+import unitAdd from './components/unitAdd'
+import unitGroupAdd from './components/unitGroupAdd'
+export default {
+  name: '',
+  data() {
+    return {
+      unitList:''
+    };
+  },
+  components:{list,Del,unitAdd,unitGroupAdd},
+  computed:{
+  },
+  watch:{
+  },
+  created() {
+    this.getUnit()
+  },
+  methods: {
+    /* 计量单位增加成功 */
+    unitAddSuccess() {
+      this.$refs.list.getUnit()
+    },
+    /* 计量单位删除成功 */
+    UnitDeleteSuccess() {
+      this.$refs.list.getUnit()
+    },
+    /* 计量组添加成功 */
+    unitGroupAddSuccess() {
+      this.$refs.list.getUnitGroup()
+    },
+    /* 计量组删除成功 */
+    unitGroupDelSuccess() {
+      this.$refs.list.getUnitGroup()
+    },
+    /* 获取单位列表 */
+    async getUnit() {
+      let res = await this.$api.requested({
+        "id": "20220922084803",
+        "version":1,
+        "content": {
+          "nocache":true,
+          "where":{
+              "condition":""
+          }
+        }
+      })
+      this.unitList = res.data
+      console.log(res)
+    },
+  },
+};
+</script>
+
+<style scoped>
+
+</style>

+ 0 - 0
src/SDrpanagement/commdiityGroup/index.vue → src/SDrpManagement/commdiityGroup/index.vue


+ 3 - 3
src/SManagement/project_target/modules/editInfo.vue

@@ -32,7 +32,7 @@
     </div>
     <div class="container normal-panel" style="margin-top:16px">
       <div class="header" style="margin-bottom:16px">
-        <Search />
+        <Search @searchActive="searchActive" @clearData="clearData" />
         <add-project @addSuccess="getprojectTargetList" />
       </div>
       <tableLayout v-if="list" :layout="tablecols" :data="list" :custom="false" height="300">
@@ -91,8 +91,8 @@ export default {
       let res = await this.$api.requested({
           "id": 20220906094602,
           "content": {
-              "year": 2023,
-              "hrid": this.hrid,
+              "year": this.$route.query.year,
+              "hrid": this.$route.query.id,
               // "sa_salestargetbillid": 2//可不传
           }
       })

+ 13 - 0
src/router/HDrpManagement.js

@@ -1,4 +1,17 @@
 const HDrpManagement = [
+<<<<<<< HEAD
   
+=======
+  {
+    path: '/sm_unit',
+    name: 'unit',
+    meta: {
+      title: '计量单位',
+      ast_nav: true,
+      keeproute: true
+    },
+    component: () => import(/* webpackChunkName: "about" */ '@/HDrpManagement/unit/index')
+  }
+>>>>>>> xiaoqin
 ]
 export default HDrpManagement