6 changed files with 953 additions and 507 deletions
			
			
		- 
					2src/assets/css/global_button.css
 - 
					6src/assets/css/global_table.css
 - 
					403src/components/customerOrg/customerOrgGroupAsbitem.vue
 - 
					483src/components/customerOrg/customerOrgGroupList.vue
 - 
					16src/components/report/CusOrgOCX.vue
 - 
					542src/views/customerOrg/customerOrgGroup.vue
 
@ -0,0 +1,403 @@ | 
				
			|||
<template> | 
				
			|||
  <div style="display: flex; margin-top:5px;"> | 
				
			|||
    <div :style="'display: flex;width:' + (window.pageWidth - 45 - 110) + 'px;'"> | 
				
			|||
      <!--未选组合项目--> | 
				
			|||
      <div style="display: block; width:255px;"> | 
				
			|||
        <div> | 
				
			|||
          <span>项目类别</span> | 
				
			|||
          <el-select | 
				
			|||
            v-model="value" | 
				
			|||
            placeholder="请选择" | 
				
			|||
            style="margin-left: 10px" | 
				
			|||
            @change="getprojectgroups" | 
				
			|||
            clearable size="small" | 
				
			|||
          > | 
				
			|||
            <el-option | 
				
			|||
              v-for="item in options" | 
				
			|||
              :key="item.id" | 
				
			|||
              :label="item.displayName" | 
				
			|||
              :value="item.id" | 
				
			|||
            > | 
				
			|||
            </el-option> | 
				
			|||
          </el-select> | 
				
			|||
        </div> | 
				
			|||
        <div class="box"> | 
				
			|||
          <el-table :data="tabledata" border size="small" | 
				
			|||
            @selection-change="handleSelectionChange" highlight-current-row | 
				
			|||
            :height="window.pageHeight < 665 ? 200:(window.pageHeight - 110 - 355)" | 
				
			|||
          > | 
				
			|||
            <!-- | 
				
			|||
            <el-table-column type="selection" align="center" ></el-table-column> | 
				
			|||
            --> | 
				
			|||
            <el-table-column type="index" align="center" min-width="40"/> | 
				
			|||
            <el-table-column | 
				
			|||
              label="未选组合项目" min-width="180" | 
				
			|||
              prop="displayName" align="center" | 
				
			|||
            ></el-table-column> | 
				
			|||
          </el-table> | 
				
			|||
        </div> | 
				
			|||
      </div> | 
				
			|||
 | 
				
			|||
      <!--中间操作按钮--> | 
				
			|||
      <div style="display: block;margin: 40px 10px 0 10px;"> | 
				
			|||
        <div> | 
				
			|||
          <el-button class="btnClass" @click="removedata" >添加 <i class="el-icon-arrow-right"></i></el-button> | 
				
			|||
        </div> | 
				
			|||
        <div> | 
				
			|||
          <el-button class="btnClass" @click="removedata">全部添加</el-button> | 
				
			|||
        </div> | 
				
			|||
        <div> | 
				
			|||
          <el-button class="btnClass" | 
				
			|||
            @click="addselecteditems" | 
				
			|||
            >移除 <i class="el-icon-arrow-left"></i | 
				
			|||
          ></el-button> | 
				
			|||
        </div> | 
				
			|||
        <div> | 
				
			|||
          <el-button class="btnClass" @click="removedata">全部移除</el-button> | 
				
			|||
        </div> | 
				
			|||
        <div> | 
				
			|||
          <el-button class="btnClass" | 
				
			|||
            @click="Onsubmit" | 
				
			|||
            >保存 | 
				
			|||
          </el-button> | 
				
			|||
        </div> | 
				
			|||
      </div> | 
				
			|||
 | 
				
			|||
      <!--已选组合项目--> | 
				
			|||
      <div :style="'display: block; width:' + (window.pageWidth - 255 - 120 - 45 - 110) + 'px;'"> | 
				
			|||
        <div style="height:32px;"> | 
				
			|||
          <span>快速选择</span> | 
				
			|||
          <el-select | 
				
			|||
            v-model="value" | 
				
			|||
            placeholder="请选择" | 
				
			|||
            style="margin-left: 10px" | 
				
			|||
            @change="getprojectgroups" | 
				
			|||
            clearable size="small" | 
				
			|||
          > | 
				
			|||
            <el-option | 
				
			|||
              v-for="item in options" | 
				
			|||
              :key="item.id" | 
				
			|||
              :label="item.displayName" | 
				
			|||
              :value="item.id" | 
				
			|||
            > | 
				
			|||
            </el-option> | 
				
			|||
          </el-select> | 
				
			|||
        </div> | 
				
			|||
        <div class="box"> | 
				
			|||
          <el-table :data="customerOrgGroupAsbitems" border size="small" | 
				
			|||
            @selection-change="selecteditems" highlight-current-row | 
				
			|||
            :height="window.pageHeight < 665 ? 200:(window.pageHeight - 110 - 355)" | 
				
			|||
          > | 
				
			|||
            <!-- | 
				
			|||
            <el-table-column type="selection"></el-table-column> | 
				
			|||
            --> | 
				
			|||
            <el-table-column type="index" min-width="40"/> | 
				
			|||
            <el-table-column | 
				
			|||
              label="已选组合项目" | 
				
			|||
              min-width="120" | 
				
			|||
              prop="displayName" | 
				
			|||
            ></el-table-column> | 
				
			|||
            <el-table-column label="标准价格" prop="price" min-width="80" align="center"> | 
				
			|||
              <template slot-scope="scope"> | 
				
			|||
                <el-input | 
				
			|||
                  disabled | 
				
			|||
                  type="text" | 
				
			|||
                  v-model="personnelUnit.nogroupselected[scope.$index].price" | 
				
			|||
                /> | 
				
			|||
              </template> | 
				
			|||
            </el-table-column> | 
				
			|||
            <el-table-column label="折扣" prop="price" min-width="60" align="center"> | 
				
			|||
              <template slot-scope="scope"> | 
				
			|||
                <el-input | 
				
			|||
                  @change="discount(scope.$index)" | 
				
			|||
                  type="text" | 
				
			|||
                  v-model="personnelUnit.nogroupselected[scope.$index].discount" | 
				
			|||
                /> | 
				
			|||
              </template> | 
				
			|||
            </el-table-column> | 
				
			|||
            <el-table-column label="价格" prop="price" min-width="80" align="center"> | 
				
			|||
              <template slot-scope="scope"> | 
				
			|||
                <el-input | 
				
			|||
                  @input="changingprices(scope.row.price)" | 
				
			|||
                  type="text" | 
				
			|||
                  v-model="personnelUnit.nogroupselected[scope.$index].price" | 
				
			|||
                /> | 
				
			|||
              </template> | 
				
			|||
            </el-table-column> | 
				
			|||
          </el-table> | 
				
			|||
        </div> | 
				
			|||
      </div> | 
				
			|||
    </div> | 
				
			|||
    <!--批量操作按钮(复制套餐与分组)--> | 
				
			|||
    <div style="display: block;margin-left: 10px;"> | 
				
			|||
      <div style="margin-top: 50px;"> | 
				
			|||
        <el-button class="btnClass">复制分组</el-button> | 
				
			|||
      </div> | 
				
			|||
      <div> | 
				
			|||
        <el-button class="btnClass">复制套餐</el-button> | 
				
			|||
      </div> | 
				
			|||
    </div>     | 
				
			|||
  </div> | 
				
			|||
</template> | 
				
			|||
<script> | 
				
			|||
import { getapi, postapi } from "@/api/api"; | 
				
			|||
import { mapState } from "vuex"; | 
				
			|||
import { arrayExistObj } from "../../utlis/proFunc"; | 
				
			|||
 | 
				
			|||
export default { | 
				
			|||
  data() { | 
				
			|||
    return { | 
				
			|||
      customerOrgGroupAsbitems:[], //分组包含组合项目 | 
				
			|||
      saveornot: true, //保存按钮 | 
				
			|||
      selecteddata: [], //已选数据 | 
				
			|||
      unselecteddata: [], //未选数据 | 
				
			|||
      unselecteddata: [], //右边勾选中 | 
				
			|||
      rightselctedata: [], //右侧已选 | 
				
			|||
      options: [], | 
				
			|||
      value: "", | 
				
			|||
      dialogVisible: false, | 
				
			|||
      copyGroupdialogVisible: false, | 
				
			|||
      packagelist: [], | 
				
			|||
      tabledata: [], | 
				
			|||
      temporaryselection: [], //已选组合项目table | 
				
			|||
      copegroupdata: [], //复制分组 | 
				
			|||
      addrulst: [], //添加保存的Id | 
				
			|||
      price: "", //价格 | 
				
			|||
      title: 1, | 
				
			|||
    }; | 
				
			|||
  }, | 
				
			|||
  computed: { | 
				
			|||
    ...mapState(["window","dict"]), | 
				
			|||
  }, | 
				
			|||
  created() { | 
				
			|||
    this.getitemtype(); | 
				
			|||
    this.getportfolioitems(); | 
				
			|||
  }, | 
				
			|||
  methods: { | 
				
			|||
    changingprices(price) { | 
				
			|||
      this.price = price; | 
				
			|||
    }, | 
				
			|||
    discount(index) { | 
				
			|||
      console.log(index); //100标准价格 | 
				
			|||
      this.personnelUnit.nogroupselected[index].price = Math.round( | 
				
			|||
        (100 * Number(this.personnelUnit.nogroupselected[index].queueTime)) / | 
				
			|||
          100, | 
				
			|||
        2 | 
				
			|||
      ); | 
				
			|||
    }, | 
				
			|||
    inputchang(row, newVal) { | 
				
			|||
      this.price = row.price; | 
				
			|||
      console.log(this.price); | 
				
			|||
    }, | 
				
			|||
    //保存按钮 | 
				
			|||
    Onsubmit() { | 
				
			|||
      if (!this.personnelUnit.customerOrgGroupId) { | 
				
			|||
        alert("请先选择单位分组"); | 
				
			|||
        return; | 
				
			|||
      } else { | 
				
			|||
        console.log(this.personnelUnit.nogroupselected); | 
				
			|||
        postapi("/api/app/customer-org-group-detail/many", this.addrulst).then( | 
				
			|||
          (res) => { | 
				
			|||
            this.$message.success("操作成功"); | 
				
			|||
            console.log(this.addrulst); | 
				
			|||
          } | 
				
			|||
        ); | 
				
			|||
      } | 
				
			|||
      // if (this.title == 2) { | 
				
			|||
      //   if (!this.personnelUnit.customerOrgGroupId) { 3a0c563d-cb6a-3638-6e06-651f282e17ca | 
				
			|||
      //     alert("请先选择单位分组");                    | 
				
			|||
      //     return; | 
				
			|||
      //   } else { | 
				
			|||
      //     console.log(this.personnelUnit.nogroupselected); | 
				
			|||
      //     postapi( | 
				
			|||
      //       "/api/app/customer-org-group-detail/many", | 
				
			|||
      //       this.addrulst | 
				
			|||
      //     ).then((res) => { | 
				
			|||
      //       this.$message.success("操作成功"); | 
				
			|||
      //       console.log(this.addrulst); | 
				
			|||
      //     }); | 
				
			|||
      //   } | 
				
			|||
      // } | 
				
			|||
 | 
				
			|||
      // console.log(this.addrulst); | 
				
			|||
      // // console.log(this.personnelUnit.form.id); | 
				
			|||
      // if (this.addrulst[customerOrgGroupId] == undefined) { | 
				
			|||
      //   this.$message.warning("请先选择单位分组"); | 
				
			|||
      // } else { | 
				
			|||
      //   postapi("/api/app/customer-org-group-detail/many", this.addrulst).then( | 
				
			|||
      //     (res) => { | 
				
			|||
      //       console.log(this.personnelUnit.form.id); | 
				
			|||
      //       this.$message.success("操作成功"); | 
				
			|||
      //     } | 
				
			|||
      //   ); | 
				
			|||
      // } | 
				
			|||
    }, | 
				
			|||
    //移除按钮 | 
				
			|||
    addselecteditems() { | 
				
			|||
      let lfind = -1; | 
				
			|||
      console.log(this.personnelUnit.id); | 
				
			|||
      if (this.personnelUnit.form.id == "") { | 
				
			|||
        alert("请先选择单位类别"); | 
				
			|||
      } else { | 
				
			|||
        // 让按钮恢复禁用 | 
				
			|||
        this.saveornot = false; | 
				
			|||
        //personnelUnit.nogroupselected | 
				
			|||
        if (this.rightselctedata.length == 0) { | 
				
			|||
          this.$message.warning("已选数据为空无法移动"); | 
				
			|||
        } else { | 
				
			|||
          // this.title = 2; | 
				
			|||
          let count = this.rightselctedata.length - 1; | 
				
			|||
          for (var i = count; i >= 0; i--) { | 
				
			|||
            if ([...new Set(this.tabledata)]) { | 
				
			|||
              this.tabledata.push(this.rightselctedata[i]); | 
				
			|||
              this.personnelUnit.nogroupselected.splice(i, 1); | 
				
			|||
            } | 
				
			|||
          } | 
				
			|||
          console.log(this.personnelUnit.customerOrgGroupId); | 
				
			|||
          // this. | 
				
			|||
          this.rightselctedata.forEach((item) => { | 
				
			|||
            lfind = arrayExistObj( | 
				
			|||
              this.personnelUnit.nogroupselected, | 
				
			|||
              "id", | 
				
			|||
              item.id | 
				
			|||
            ); | 
				
			|||
 | 
				
			|||
            if (lfind > -1) this.personnelUnit.nogroupselected.splice(lfind, 1); | 
				
			|||
            this.addrulst.push({ | 
				
			|||
              asbitemId: item.id, | 
				
			|||
              price: item.price, | 
				
			|||
              // price: this.price, | 
				
			|||
              customerOrgGroupId: this.personnelUnit.customerOrgGroupId, | 
				
			|||
            }); | 
				
			|||
          }); | 
				
			|||
        } | 
				
			|||
      } | 
				
			|||
    }, | 
				
			|||
    //右侧勾选按钮 | 
				
			|||
    selecteditems(val) { | 
				
			|||
      this.rightselctedata = val; | 
				
			|||
      console.log(this.rightselctedata); | 
				
			|||
    }, | 
				
			|||
    // 添加按钮 | 
				
			|||
    removedata() { | 
				
			|||
      let lfind = -1; | 
				
			|||
      if (this.personnelUnit.form.id == "") { | 
				
			|||
        alert("请先选择单位分组"); | 
				
			|||
      } else { | 
				
			|||
        if (this.unselecteddata.length == 0) { | 
				
			|||
          this.$message.warning("未选数据为空无法移动"); | 
				
			|||
        } else { | 
				
			|||
          this.saveornot = false; | 
				
			|||
          let count = this.unselecteddata.length - 1; | 
				
			|||
          for (var i = count; i >= 0; i--) { | 
				
			|||
            // this.tabledata.splice(i, 1); | 
				
			|||
            if ([...new Set(this.personnelUnit.nogroupselected)]) { | 
				
			|||
              // this.unselecteddata.push(this.unselecteddata[i]); | 
				
			|||
              this.personnelUnit.nogroupselected.push(this.unselecteddata[i]); | 
				
			|||
              this.tabledata.splice(this.tabledata[i], 1); | 
				
			|||
            } | 
				
			|||
            // this.personnelUnit.nogroupselected.push(this.unselecteddata[i]); | 
				
			|||
          } | 
				
			|||
          console.log(this.personnelUnit.customerOrgGroupId); | 
				
			|||
          //  let prices = ""; | 
				
			|||
          this.personnelUnit.nogroupselected.forEach((items) => { | 
				
			|||
            // prices = items.price; | 
				
			|||
            //this.tabledata | 
				
			|||
            console.log(items); | 
				
			|||
            lfind = arrayExistObj(this.tabledata, "id", items.id); | 
				
			|||
            if (lfind > -1) this.tabledata.splice(lfind, 1); | 
				
			|||
            this.addrulst.push({ | 
				
			|||
              asbitemId: items.id, // "3a0b2f0c-f884-bec4-a350-79b46b455a2d" | 
				
			|||
              price: items.price, | 
				
			|||
              // price: this.price == "" ? items.price : this.price, | 
				
			|||
              customerOrgGroupId: this.personnelUnit.customerOrgGroupId, | 
				
			|||
            }); | 
				
			|||
          }); | 
				
			|||
          console.log(this.addrulst, "hhhhhhh"); | 
				
			|||
        } | 
				
			|||
      } | 
				
			|||
    }, | 
				
			|||
    // 左侧未选 | 
				
			|||
    handleSelectionChange(val) { | 
				
			|||
      // this.selecteddata = val; | 
				
			|||
      this.unselecteddata = val; | 
				
			|||
      console.log(this.unselecteddata); | 
				
			|||
    }, | 
				
			|||
    //获取所有组合项目 | 
				
			|||
    getportfolioitems() { | 
				
			|||
      getapi("/api/app/asbitem/in-filter?Filter").then((res) => { | 
				
			|||
        this.tabledata = res.data.items; | 
				
			|||
      }); | 
				
			|||
    }, | 
				
			|||
    //项目类别选择 | 
				
			|||
    getprojectgroups(v) { | 
				
			|||
      if (v !== "") { | 
				
			|||
        getapi(`/api/app/asbitem/in-item-type/${v}`).then((res) => { | 
				
			|||
          console.log(res); | 
				
			|||
          this.tabledata = res.data; | 
				
			|||
        }); | 
				
			|||
      } else { | 
				
			|||
        getapi("/api/app/asbitem/in-filter?Filter").then((res) => { | 
				
			|||
          this.tabledata = res.data.items; | 
				
			|||
        }); | 
				
			|||
      } | 
				
			|||
    }, | 
				
			|||
     | 
				
			|||
     | 
				
			|||
    getitemtype() { | 
				
			|||
      getapi("/api/app/item-type/by-code-all").then((res) => { | 
				
			|||
        this.options = res.data; | 
				
			|||
      }); | 
				
			|||
    }, | 
				
			|||
 | 
				
			|||
    //获取当前列列表数据 | 
				
			|||
    listeninglist(customerOrgGroupId) { | 
				
			|||
      getapi(`/api/app/customer-org-group/${customerOrgGroupId}`).then( | 
				
			|||
        (res) => { | 
				
			|||
          this.personnelUnit.form = res.data; | 
				
			|||
          console.log(res); | 
				
			|||
        } | 
				
			|||
      ); | 
				
			|||
      getapi( | 
				
			|||
        `/api/app/customer-org-group-detail/customer-org-group-detail-in-asbitem/${customerOrgGroupId}` | 
				
			|||
      ).then((res) => { | 
				
			|||
        console.log( | 
				
			|||
          `/api/app/customer-org-group-detail/customer-org-group-detail-in-asbitem/${customerOrgGroupId}`, | 
				
			|||
          res | 
				
			|||
        ); | 
				
			|||
        this.personnelUnit.nogroupselected = res.data; | 
				
			|||
      }); | 
				
			|||
    }, | 
				
			|||
    // getapi(`/api/app/customer-org-group/${row.id}`).then((res) | 
				
			|||
  }, | 
				
			|||
  //监听事件 | 
				
			|||
  watch: { | 
				
			|||
    // | 
				
			|||
    "personnelUnit.customerOrgGroupId"(newVal, oldVal) { | 
				
			|||
      console.log( | 
				
			|||
        "watch patientRegister.addTimes newVal:", | 
				
			|||
        newVal, | 
				
			|||
        " oldVal:", | 
				
			|||
        oldVal | 
				
			|||
      ); | 
				
			|||
      if (newVal != oldVal) { | 
				
			|||
        this.listeninglist(newVal); | 
				
			|||
        // | 
				
			|||
      } | 
				
			|||
    }, | 
				
			|||
  }, | 
				
			|||
}; | 
				
			|||
</script> | 
				
			|||
<style scoped> | 
				
			|||
 | 
				
			|||
.box {   | 
				
			|||
  margin-top: 5px; | 
				
			|||
  border: 1px solid #000; | 
				
			|||
} | 
				
			|||
 | 
				
			|||
.btnClass { | 
				
			|||
  width:100px; | 
				
			|||
  margin-bottom: 5px | 
				
			|||
} | 
				
			|||
 | 
				
			|||
</style> | 
				
			|||
@ -1,483 +0,0 @@ | 
				
			|||
<template> | 
				
			|||
  <div> | 
				
			|||
    <div> | 
				
			|||
      <div style="display: flex;"> | 
				
			|||
        <div> | 
				
			|||
          <span>体检单位:</span> | 
				
			|||
          <el-select | 
				
			|||
            v-model="customerOrgId" | 
				
			|||
            placeholder="请选择体检单位" filterable clearable | 
				
			|||
            style="margin-left: 10px;"  | 
				
			|||
            @change="changeCustomerOrg" | 
				
			|||
            size="small" | 
				
			|||
          > | 
				
			|||
            <el-option | 
				
			|||
              v-for="item in customerOrg" | 
				
			|||
              :key="item.id" | 
				
			|||
              :label="item.displayName" | 
				
			|||
              :value="item.id" | 
				
			|||
            > | 
				
			|||
            </el-option> | 
				
			|||
          </el-select> | 
				
			|||
        </div> | 
				
			|||
        <div style="margin-left: 20px;"> | 
				
			|||
          <span>单位体检次数:</span> | 
				
			|||
          <el-select v-model="customerOrgRegister" placeholder="次数" style="width: 60px;margin-left: 10px;" size="small" | 
				
			|||
            @change="changeTimes" value-key="id"> | 
				
			|||
            <el-option v-for="item in customerOrgRegisterList" :key="item.id" :label="item.medicalTimes" | 
				
			|||
              :value="item" /> | 
				
			|||
          </el-select> | 
				
			|||
        </div> | 
				
			|||
      </div> | 
				
			|||
    </div> | 
				
			|||
    <div style="display: flex;"> | 
				
			|||
      <el-table | 
				
			|||
        :data="customerOrgGroups" | 
				
			|||
        style="margin-top: 2px" | 
				
			|||
        row-key="id" border | 
				
			|||
        height="300px" size="small" | 
				
			|||
        highlight-current-row | 
				
			|||
        @row-click="rowClick" | 
				
			|||
      > | 
				
			|||
        <el-table-column type="index" label="序号" min-width="50" align="center"/> | 
				
			|||
        <el-table-column prop="displayName" label="名称" min-width="150" /> | 
				
			|||
        <el-table-column prop="price" label="价格" min-width="60" align="center"/> | 
				
			|||
        <el-table-column prop="forSexId" label="适用性别" min-width="60" align="center"> | 
				
			|||
          <template slot-scope="scope"> | 
				
			|||
            {{ dddw(dict.forSex,'id',scope.row.forSexId,'displayName') }} | 
				
			|||
          </template>     | 
				
			|||
        </el-table-column> | 
				
			|||
        <el-table-column prop="maritalStatusId" label="适用婚姻状况" min-width="80" align="center"> | 
				
			|||
          <template slot-scope="scope"> | 
				
			|||
            {{ dddw(dict.forMaritalStatus,'id',scope.row.maritalStatusId,'displayName') }} | 
				
			|||
          </template>          | 
				
			|||
        </el-table-column> | 
				
			|||
        <el-table-column prop="creatorName" label="创建者" min-width="60" align="center" /> | 
				
			|||
        <el-table-column label="创建时间" min-width="150" align="center" > | 
				
			|||
          <template slot-scope="scope"> | 
				
			|||
            {{ scope.row.creationTime ? moment(scope.row.creationTime).format('yyyy-MM-DD HH:mm:ss'):'' }} | 
				
			|||
          </template> | 
				
			|||
        </el-table-column> | 
				
			|||
        <el-table-column label="操作"> | 
				
			|||
          <template> | 
				
			|||
            <el-tag | 
				
			|||
              class="move" | 
				
			|||
              style="cursor: move; margin-left: 15px" | 
				
			|||
              draggable="true" | 
				
			|||
            > | 
				
			|||
              <i class="el-icon-d-caret" style="width: 1rem; height: 1rem"></i> | 
				
			|||
            </el-tag> | 
				
			|||
          </template> | 
				
			|||
        </el-table-column> | 
				
			|||
      </el-table>       | 
				
			|||
      <div style="margin-left: 10px;"> | 
				
			|||
        <div style="margin-top: 10px"> | 
				
			|||
          <el-button | 
				
			|||
            type="" | 
				
			|||
            @click="btnAdd" | 
				
			|||
            class="commonbutton" | 
				
			|||
           | 
				
			|||
            >新增</el-button | 
				
			|||
          > | 
				
			|||
        </div> | 
				
			|||
        <div style="margin-top: 10px"> | 
				
			|||
          <el-button type="" @click="btnEdit" class="commonbutton" | 
				
			|||
            >编辑</el-button | 
				
			|||
          > | 
				
			|||
        </div> | 
				
			|||
        <div style="margin-top: 10px"> | 
				
			|||
          <el-button type="" @click="btnDel" class="commonbutton" | 
				
			|||
            >删除</el-button | 
				
			|||
          > | 
				
			|||
        </div> | 
				
			|||
        <div style="margin-top: 10px"> | 
				
			|||
          <el-button type="" @click="topping" class="commonbutton" | 
				
			|||
            >置顶</el-button | 
				
			|||
          > | 
				
			|||
        </div> | 
				
			|||
        <div style="margin-top: 10px"> | 
				
			|||
          <el-button type="" @click="bottoming" class="commonbutton" | 
				
			|||
            >置低</el-button | 
				
			|||
          > | 
				
			|||
        </div> | 
				
			|||
        <div style="margin-top: 10px"> | 
				
			|||
          <el-button | 
				
			|||
            type="" | 
				
			|||
            @click="sortok" | 
				
			|||
            :disabled="isshow" | 
				
			|||
            class="commonbutton" | 
				
			|||
            >确定</el-button | 
				
			|||
          > | 
				
			|||
        </div> | 
				
			|||
      </div> | 
				
			|||
       | 
				
			|||
    </div> | 
				
			|||
 | 
				
			|||
    <!-- 新增或者编辑弹框 --> | 
				
			|||
    <el-dialog | 
				
			|||
      :title="form.id ? '编辑' : '新增'" | 
				
			|||
      :visible.sync="dialogVisible" | 
				
			|||
      width="800px" | 
				
			|||
    >   | 
				
			|||
      <el-form :model="form" label-width="80px" :rules="rules" ref='form'> | 
				
			|||
        <el-row> | 
				
			|||
          <el-col :span="8"> | 
				
			|||
            <el-form-item prop="displayName" label="分组名称"> | 
				
			|||
              <el-input v-model="form.displayName"></el-input> | 
				
			|||
            </el-form-item> | 
				
			|||
          </el-col> | 
				
			|||
          <el-col :span="8"> | 
				
			|||
            <el-form-item label="价格"> | 
				
			|||
              <el-input v-model="form.price"></el-input> | 
				
			|||
            </el-form-item> | 
				
			|||
          </el-col> | 
				
			|||
          <el-col :span="8"> | 
				
			|||
            <el-form-item label="适用性别"> | 
				
			|||
              <el-select v-model="form.forSexId" placeholder="请选择"> | 
				
			|||
                <el-option | 
				
			|||
                  v-for="item in dict.forSex" | 
				
			|||
                  :key="item.id" | 
				
			|||
                  :label="item.displayName" | 
				
			|||
                  :value="item.id" | 
				
			|||
                > | 
				
			|||
                </el-option> | 
				
			|||
              </el-select> | 
				
			|||
            </el-form-item> | 
				
			|||
          </el-col> | 
				
			|||
          <el-col :span="8"> | 
				
			|||
            <el-form-item label="婚姻状况"> | 
				
			|||
              <el-select | 
				
			|||
                v-model="form.maritalStatusId" | 
				
			|||
                placeholder="请选择" | 
				
			|||
                style="width: 100%" | 
				
			|||
              > | 
				
			|||
                <el-option | 
				
			|||
                  v-for="item in dict.forMaritalStatus" | 
				
			|||
                  :key="item.id" | 
				
			|||
                  :label="item.displayName" | 
				
			|||
                  :value="item.id" | 
				
			|||
                > | 
				
			|||
                </el-option> | 
				
			|||
              </el-select> | 
				
			|||
            </el-form-item> | 
				
			|||
          </el-col> | 
				
			|||
          <el-col :span="8"> | 
				
			|||
            <el-form-item label="年龄下限"> | 
				
			|||
              <el-input v-model="form.ageLowerLimit"></el-input> | 
				
			|||
            </el-form-item> | 
				
			|||
          </el-col> | 
				
			|||
          <el-col :span="8"> | 
				
			|||
            <el-form-item label="年龄上限"> | 
				
			|||
              <el-input v-model="form.ageUpperLimit"></el-input> | 
				
			|||
            </el-form-item> | 
				
			|||
          </el-col> | 
				
			|||
          <el-col :span="8"> | 
				
			|||
            <el-form-item label="适用职务"> | 
				
			|||
              <el-input v-model="form.jobPost"></el-input> | 
				
			|||
            </el-form-item> | 
				
			|||
          </el-col> | 
				
			|||
          <el-col :span="8"> | 
				
			|||
            <el-form-item label="适用职称"> | 
				
			|||
              <el-input v-model="form.jobTitle"></el-input> | 
				
			|||
            </el-form-item> | 
				
			|||
          </el-col> | 
				
			|||
          <el-col :span="8"> | 
				
			|||
            <el-form-item label="备注"> | 
				
			|||
              <el-input v-model="form.remark"></el-input> | 
				
			|||
            </el-form-item> | 
				
			|||
          </el-col> | 
				
			|||
        </el-row> | 
				
			|||
      </el-form> | 
				
			|||
      <span slot="footer" class="dialog-footer"> | 
				
			|||
        <el-button @click="dialogVisible = false">取 消</el-button> | 
				
			|||
        <el-button type="primary" @click="onSubmit('form')">确 定</el-button> | 
				
			|||
      </span> | 
				
			|||
    </el-dialog> | 
				
			|||
    <!--  --> | 
				
			|||
  </div> | 
				
			|||
</template> | 
				
			|||
<script> | 
				
			|||
import moment from "moment"; | 
				
			|||
import Sortable from "sortablejs"; | 
				
			|||
import { getapi, postapi, putapi, deletapi } from "@/api/api"; | 
				
			|||
import { mapState } from "vuex"; | 
				
			|||
import { dddw, deepCopy,objCopy,arrayExistObj } from "../../utlis/proFunc"; | 
				
			|||
 | 
				
			|||
export default { | 
				
			|||
  data() { | 
				
			|||
    return { | 
				
			|||
      customerOrg:[],       //体检单位 | 
				
			|||
      customerOrgGroups:[], //体检单位分组 | 
				
			|||
      customerOrgId:'',     //当前选中的体检单位id | 
				
			|||
      customerOrgRegisterList:[],   //体检次数列表 | 
				
			|||
      customerOrgRegister:{},       //体检次数 | 
				
			|||
 | 
				
			|||
      isshow: true, | 
				
			|||
      form: {     //体检单位分组 | 
				
			|||
        id:'', | 
				
			|||
        customerOrgRegisterId:null, //所属体检次数 | 
				
			|||
        displayName: "", | 
				
			|||
        price: 0, | 
				
			|||
        forSexId: "", | 
				
			|||
        maritalStatusId: "", | 
				
			|||
        ageLowerLimit: null, | 
				
			|||
        ageUpperLimit: null, | 
				
			|||
        jobPost: "", | 
				
			|||
        jobTitle: "", | 
				
			|||
        remark: "", | 
				
			|||
        isMaxMedicalTimes:'N' | 
				
			|||
      }, | 
				
			|||
      formInit:{}, | 
				
			|||
      rules:{ | 
				
			|||
        displayName:[ | 
				
			|||
          { required: true, message: "请填写分组名称", trigger: "blur" }, | 
				
			|||
        ],         | 
				
			|||
      }, | 
				
			|||
 | 
				
			|||
      dialogVisible: false, | 
				
			|||
      tableData: [], | 
				
			|||
      initTableData: [], | 
				
			|||
      // tableData: [ | 
				
			|||
 | 
				
			|||
      // ], | 
				
			|||
    }; | 
				
			|||
  }, | 
				
			|||
  computed: { | 
				
			|||
    ...mapState(["personnelUnit","window","dict"]), | 
				
			|||
  }, | 
				
			|||
  created() { | 
				
			|||
    this.rowDrop(); | 
				
			|||
    this.formInit = deepCopy(this.form)     | 
				
			|||
  }, | 
				
			|||
  mounted() {   | 
				
			|||
    //获取初始数据(单位、适用性别)   | 
				
			|||
    this.dictInit() | 
				
			|||
  }, | 
				
			|||
  methods: {     | 
				
			|||
    moment,dddw, | 
				
			|||
    //确定排序 | 
				
			|||
    sortok() { | 
				
			|||
      const result = []; | 
				
			|||
      this.tableData.forEach((item, index) => { | 
				
			|||
        // index 从0开始的, 你的displayOrder从大到小排 | 
				
			|||
        console.log(item.id); | 
				
			|||
        // const currentDisplayOrder = this.tableData.length -1 | 
				
			|||
        const currentDisplayOrder = this.initTableData[index].displayOrder; | 
				
			|||
        if (item.displayOrder != currentDisplayOrder) { | 
				
			|||
          // 如果它的displayOrder和它当前所在的位置不同代表挪动过位置 | 
				
			|||
          result.push({ id: item.id, displayOrder: currentDisplayOrder }); | 
				
			|||
        } | 
				
			|||
      }); | 
				
			|||
      putapi("/api/app/customerorggroup/updatesortmany", { | 
				
			|||
        itemList: result, | 
				
			|||
      }).then((res) => { | 
				
			|||
        this.$message.success("操作成功"); | 
				
			|||
        this.isshow = true; | 
				
			|||
      }); | 
				
			|||
    }, | 
				
			|||
    //初始化Sortable组件 | 
				
			|||
    rowDrop() { | 
				
			|||
      this.$nextTick(() => { | 
				
			|||
        const tbody = document.querySelector(".el-table__body-wrapper tbody"); | 
				
			|||
        const _this = this; | 
				
			|||
        Sortable.create(tbody, { | 
				
			|||
          handle: ".move", | 
				
			|||
          animation: 300, | 
				
			|||
          onEnd({ newIndex, oldIndex }) { | 
				
			|||
            _this.isshow = false; | 
				
			|||
            const currRow = _this.tableData.splice(oldIndex, 1)[0]; | 
				
			|||
            _this.tableData.splice(newIndex, 0, currRow); | 
				
			|||
            _this.tableData.map((item, index) => { | 
				
			|||
              if (index == newIndex && index == oldIndex) { | 
				
			|||
              } else if (index == oldIndex) { | 
				
			|||
              } else if (index == newIndex) { | 
				
			|||
              } | 
				
			|||
            }); | 
				
			|||
            console.log(_this.tableData.map((item) => item.displayOrder)); | 
				
			|||
          }, | 
				
			|||
        }); | 
				
			|||
      }); | 
				
			|||
    }, | 
				
			|||
    | 
				
			|||
    //置低 | 
				
			|||
    bottoming() { | 
				
			|||
      if (this.form.id == undefined) { | 
				
			|||
        this.$message.warning("请选择操作的数据"); | 
				
			|||
      } else { | 
				
			|||
        putapi( | 
				
			|||
          `/api/app/customerorggroup/updatemanysort?id=${this.form.id}&SortType=2` | 
				
			|||
        ).then((res) => { | 
				
			|||
          this.$message.success("操作成功"); | 
				
			|||
        }); | 
				
			|||
      } | 
				
			|||
    }, | 
				
			|||
 | 
				
			|||
    //置顶 | 
				
			|||
    topping() { | 
				
			|||
      if (this.form.id == undefined) { | 
				
			|||
        this.$message.warning("请选择操作的数据"); | 
				
			|||
      } else { | 
				
			|||
        putapi( | 
				
			|||
          `/api/app/customerorggroup/updatemanysort?id=${this.form.id}&SortType=1` | 
				
			|||
        ).then((res) => { | 
				
			|||
          this.$message.success("操作成功"); | 
				
			|||
        }); | 
				
			|||
      } | 
				
			|||
    }, | 
				
			|||
     | 
				
			|||
    //获取初始数据 | 
				
			|||
    dictInit() { | 
				
			|||
      //获取单位列表 | 
				
			|||
      getapi("/api/app/customer-org/parent-all").then((res) => { | 
				
			|||
        this.customerOrg = res.data; | 
				
			|||
      }); | 
				
			|||
 | 
				
			|||
      //获取适用性别 | 
				
			|||
      getapi("/api/app/for-sex").then((res) => { | 
				
			|||
        if(res.code != -1){ | 
				
			|||
          this.dict.forSex = res.data | 
				
			|||
        }         | 
				
			|||
      }) | 
				
			|||
    }, | 
				
			|||
 | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    //获取体检次数下的分组 | 
				
			|||
    getCustomerOrgGroup(customerOrgRegisterId) { | 
				
			|||
      this.customerOrgGroups = [] | 
				
			|||
      getapi(`/api/app/customerorggroup/getlistinfilter?CustomerOrgRegisterId=${customerOrgRegisterId}`).then(res => { | 
				
			|||
        if (res.code != - 1) { | 
				
			|||
          this.customerOrgGroups = res.data.items; | 
				
			|||
          this.customerOrgGroups.forEach(e =>{ | 
				
			|||
            e.customerOrgRegisterId = customerOrgRegisterId | 
				
			|||
          }) | 
				
			|||
        } | 
				
			|||
      }) | 
				
			|||
    }, | 
				
			|||
 | 
				
			|||
    //选择单位 | 
				
			|||
    changeCustomerOrg(v) { | 
				
			|||
      getapi(`/api/app/customerorgregister/getlistincustomerorgid?CustomerOrgId=${v}`).then( res => { | 
				
			|||
        if(res.code != -1){ | 
				
			|||
          this.customerOrgRegisterList = res.data | 
				
			|||
          if(res.data.length > 0){ | 
				
			|||
            this.customerOrgRegister = res.data[res.data.length - 1] | 
				
			|||
            this.getCustomerOrgGroup(this.customerOrgRegister.id) | 
				
			|||
          }else{ | 
				
			|||
            this.customerOrgRegister = {} | 
				
			|||
            this.customerOrgGroups = [] | 
				
			|||
          } | 
				
			|||
        } | 
				
			|||
      })       | 
				
			|||
    }, | 
				
			|||
     | 
				
			|||
    //选择体检次数 | 
				
			|||
    changeTimes(v){ | 
				
			|||
      this.getCustomerOrgGroup(v.id) | 
				
			|||
    }, | 
				
			|||
 | 
				
			|||
    //点击分组 | 
				
			|||
    rowClick(row) { | 
				
			|||
      objCopy(row,this.form) | 
				
			|||
    }, | 
				
			|||
 | 
				
			|||
    //新增弹框 | 
				
			|||
    btnAdd() { | 
				
			|||
      if(!this.customerOrgRegister.id){ | 
				
			|||
        this.$message.warning("请选择体检次数") | 
				
			|||
        return | 
				
			|||
      } | 
				
			|||
      if(this.customerOrgRegister.isComplete.toUpperCase() == 'Y'){ | 
				
			|||
        this.$message.warning("该单位的该次体检次数已完成,不能再添加分组!") | 
				
			|||
        return | 
				
			|||
      } | 
				
			|||
       | 
				
			|||
      this.form = deepCopy(this.formInit) | 
				
			|||
      this.form.customerOrgRegisterId = this.customerOrgRegister.id | 
				
			|||
      this.dialogVisible = true;       | 
				
			|||
    }, | 
				
			|||
 | 
				
			|||
    //编辑弹框 | 
				
			|||
    btnEdit() { | 
				
			|||
      this.dialogVisible = true; | 
				
			|||
    }, | 
				
			|||
     | 
				
			|||
    //删除 | 
				
			|||
    btnDel() { | 
				
			|||
      if (!this.form.id) { | 
				
			|||
        this.$message.warning("请选择需要操作的数据"); | 
				
			|||
        return | 
				
			|||
      } | 
				
			|||
 | 
				
			|||
      this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", { | 
				
			|||
        confirmButtonText: "是", | 
				
			|||
        cancelButtonText: "  否  ", | 
				
			|||
        type: "warning", | 
				
			|||
      }).then(() => { | 
				
			|||
        return deletapi(`/api/app/customer-org-group/${this.form.id}`) | 
				
			|||
      }).then(res =>{ | 
				
			|||
        if(res.code != -1){ | 
				
			|||
          this.$message.success("删除成功"); | 
				
			|||
          let lfind = arrayExistObj(this.customerOrgGroups,'id',this.form.id) | 
				
			|||
          if(lfind > -1) this.customerOrgGroups.splice(lfind,1) | 
				
			|||
        } | 
				
			|||
      }).catch(err =>{ | 
				
			|||
        if (err == "cancel") { | 
				
			|||
          this.$message.info("已取消删除"); | 
				
			|||
        } | 
				
			|||
      })       | 
				
			|||
    }, | 
				
			|||
 | 
				
			|||
 | 
				
			|||
    onSubmit(formName) { | 
				
			|||
      this.$refs[formName].validate((valid,fields) => { | 
				
			|||
        if(!valid){ | 
				
			|||
          this.$message.warning(fields[Object.keys(fields)[0]][0].message); | 
				
			|||
          return false | 
				
			|||
        } | 
				
			|||
        | 
				
			|||
        if(!this.form.customerOrgRegisterId){ | 
				
			|||
          this.$message.warning("请选择单位体检次数!"); | 
				
			|||
          return false | 
				
			|||
        } | 
				
			|||
         | 
				
			|||
        let body = deepCopy(this.form) | 
				
			|||
        delete body.id | 
				
			|||
 | 
				
			|||
        if(this.form.id){ | 
				
			|||
          //编辑 | 
				
			|||
          putapi(`/api/app/customer-org-group/${this.form.id}`,body).then(res =>{ | 
				
			|||
            if(res.code != -1 ){               | 
				
			|||
              this.$message.success("操作成功!") | 
				
			|||
              let lfind = arrayExistObj(this.customerOrgGroups,'id',this.form.id) | 
				
			|||
              if(lfind > -1) objCopy(this.form,this.customerOrgGroups[lfind]) | 
				
			|||
              this.dialogVisible = false | 
				
			|||
            } | 
				
			|||
          }) | 
				
			|||
        }else{ | 
				
			|||
          //新增 | 
				
			|||
          postapi('/api/customerorggroup/createcustomerorggroupincustomerorgregister',body).then(res =>{ | 
				
			|||
            if(res.code != -1 ){ | 
				
			|||
              this.$message.success("操作成功!") | 
				
			|||
              this.form.id = res.data.id | 
				
			|||
              this.customerOrgGroups.push(res.data)   | 
				
			|||
              this.dialogVisible = false             | 
				
			|||
            } | 
				
			|||
          }) | 
				
			|||
        } | 
				
			|||
         | 
				
			|||
      }) | 
				
			|||
    }, | 
				
			|||
 | 
				
			|||
     | 
				
			|||
  }, | 
				
			|||
}; | 
				
			|||
</script> | 
				
			|||
<style scoped> | 
				
			|||
@import '../../assets/css/global_button.css'; | 
				
			|||
@import '../../assets/css/global_dialog.css'; | 
				
			|||
@import '../../assets/css/global_table.css'; | 
				
			|||
@import '../../assets/css/global_form.css'; | 
				
			|||
@import '../../assets/css/global_input.css'; | 
				
			|||
@import '../../assets/css/global.css'; | 
				
			|||
</style> | 
				
			|||
						Write
						Preview
					
					
					Loading…
					
					Cancel
						Save
					
		Reference in new issue