Jelajahi Sumber

1、软床报价代码更新

MY 20 jam lalu
induk
melakukan
f58c7600da

+ 2 - 0
JLHHJSvr/Com/Model/u_softbed.cs

@@ -12,6 +12,7 @@ namespace JLHHJSvr.Com.Model
     {
         public int softbed_id { get; set; }
         public string softbed_code { get; set; }
+        public string softbed_relcode { get; set; }
         public string softbed_name { get; set; }
         public int deptid { get; set; }
         public byte flag { get; set; }
@@ -28,6 +29,7 @@ namespace JLHHJSvr.Com.Model
         public string template_name { get; set; }
         public decimal commission { get; set; }
         public decimal taxes { get; set; }
+        public decimal taxrate { get; set; }
         public decimal other_rate { get; set; }
         public decimal extras_cost { get; set; }
         public decimal moneyrate { get; set; }

+ 53 - 0
JLHHJSvr/DataStore/web_configure_codemxbomlist.xml

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<select>
+  <selectstr>
+SELECT u_configure_codemxbom.pzid
+	,u_configure_codemxbom.printid
+	,u_configure_codemxbom.pid
+	,u_configure_codemxbom.mtrlid
+	,u_configure_codemxbom.sonscale
+	,u_configure_codemxbom.sonscale_formula
+	,u_configure_codemxbom.mng_cost_rate
+	,u_configure_codemxbom.profit_rate
+	,u_configure_codemxbom.realqty
+	,u_configure_codemxbom.cost
+	,u_configure_codemxbom.sonloss
+	,u_configure_codemxbom.sonloss_formula
+	,u_configure_codemxbom.sondecloss
+	,u_configure_codemxbom.sondecloss_formula
+	,u_configure_codemxbom.default_length
+	,u_configure_codemxbom.default_width
+	,u_configure_codemxbom.default_qty
+	,u_mtrl_price.name AS mtrlname
+	,u_mtrl_price.priceunit AS unit
+FROM u_configure_codemxbom
+INNER JOIN u_mtrl_price ON u_configure_codemxbom.mtrlid = u_mtrl_price.mtrlid
+  </selectstr>
+  <where>
+	<when notnull="@pzid">
+		u_configure_codemxbom.pzid = @pzid 
+	</when>
+	<when notnull="@printid">
+		u_configure_codemxbom.printid = @printid
+	</when>
+  </where>
+  <orderstr>pid</orderstr>
+  <displayfields>
+	<field field="pid">序</field>
+	<field field="mtrlname">物料名称</field>
+	<field field="unit">单位</field>
+	<field field="sonscale" datatype="number">用料量</field>
+	<field field="sonscale_formula">用料量公式</field>
+	<field field="mng_cost_rate" datatype="number">管理费用率</field>
+	<field field="profit_rate" datatype="number">利润率</field>
+	<field field="realqty" datatype="number">物料清单总用量</field>
+	<field field="cost" datatype="number">成本价</field>
+	<field field="sonloss" datatype="number">损耗率</field>
+	<field field="sonloss_formula">损耗率公式</field>
+	<field field="sondecloss" datatype="number">损附加</field>
+	<field field="sondecloss_formula">损附加公式</field>
+	<field field="default_length" datatype="number">默认长</field>
+	<field field="default_width" datatype="number">默认宽</field>
+	<field field="default_qty" datatype="number">默认数量</field>
+  </displayfields>
+</select>

+ 5 - 3
JLHHJSvr/DataStore/web_softbed_list.xml

@@ -3,6 +3,7 @@
   <selectstr>
 SELECT u_softbed.softbed_id
 	,u_softbed.softbed_code
+	,u_softbed.softbed_relcode
 	,u_softbed.softbed_name
 	,u_softbed.deptid
 	,u_softbed.create_date
@@ -39,8 +40,9 @@ FROM u_softbed
   <orderstr>create_date DESC,softbed_id DESC</orderstr>
   <displayfields>
     <field field="pid" compute="getrow()">序</field>
-	<field field="softbed_code">软床报价编码</field>
-	<field field="softbed_name">软床报价名称</field>
+	<field field="softbed_code">报价唯一码</field>
+	<field field="softbed_name">报价编码</field>
+	<field field="softbed_name">报价名称</field>
 	<field field="deptid" mapper="">部门</field>
 	<field field="flag" datatype="checkbox">审核</field>
 	<field field="create_date" datatype="datetime">报价日期</field>
@@ -57,7 +59,7 @@ FROM u_softbed
 	<field field="taxes" datatype="number">税金</field>
 	<field field="other_rate" datatype="number">额外点数</field>
 	<field field="extras_cost" datatype="number">额外费用</field>
-	<field field="moneyrate" datatype="number">汇率</field>
+	<field field="moneyrate" datatype="number" mapper="u_mattress.if_moneyrate">汇率</field>
 	<field field="dscrp">备注</field>
 	<field field="costamt" datatype="number">报价金额</field>
 	<field field="nottax_factory_cost" datatype="number">不含税出厂价</field>

+ 3 - 1
JLHHJSvr/Excutor/GetSoftBedMxListExcutor.cs

@@ -36,8 +36,10 @@ namespace JLHHJSvr.Excutor
                 con.Open();
 
                 var softbedHelpr = HelperBase.GetHelper<SoftBedHelper>(cmd, new HelperBase.Context() { tokendata = tokendata });
+                rslt.softbed = new u_softbed();
+                rslt.mxList = new List<u_softbed_mx>();
 
-                if(request.billid > 0)
+                if (request.billid > 0)
                 {
                     // 根据ID获取明细
                     rslt.softbed = softbedHelpr.GetSoftBed(request.billid);

+ 3 - 3
JLHHJSvr/Excutor/SaveConfigureBomListExcutor.cs

@@ -67,14 +67,14 @@ namespace JLHHJSvr.Excutor
                 {
                     try
                     {
-                        var fields = @"mtrlid,sonscale,sonscale_formula,mng_cost_rate,profit_rate,realqty,cost,cost_emp,cost_date,sonloss,sonloss_formula,sondecloss,sondecloss_formula,deptid_scll,price,price_formula,default_length,default_width,default_qty";
+                        var fields = @"mtrlid,sonscale,sonscale_formula,mng_cost_rate,profit_rate,realqty,sonloss,sonloss_formula,sondecloss,sondecloss_formula,default_length,default_width,default_qty";
                         foreach (var item in saveList)
                         {
                             if(item.pid <= 0)
                             {
                                 fields += ",pzid,printid,pid";
                                 int _pid = 0;
-                                cmd.CommandText = @"SELECT MAX(printid) AS printid FROM u_configure_codemxbom WHERE pzid = @pzid AND printid = @printid";
+                                cmd.CommandText = @"SELECT ISNULL(MAX(pid),0) AS pid FROM u_configure_codemxbom WHERE pzid = @pzid AND printid = @printid";
                                 cmd.Parameters.Clear();
                                 cmd.Parameters.AddWithValue("@pzid", item.pzid);
                                 cmd.Parameters.AddWithValue("@printid", item.printid);
@@ -82,7 +82,7 @@ namespace JLHHJSvr.Excutor
                                 {
                                     if (reader.Read())
                                     {
-                                        _pid = Convert.ToInt32(reader["printid"]);
+                                        _pid = Convert.ToInt32(reader["pid"]);
                                     }
                                 }
                                 item.pid = _pid + 1;

+ 1 - 1
JLHHJSvr/Excutor/SaveConfigureCodeMxExcutor.cs

@@ -64,7 +64,7 @@ namespace JLHHJSvr.Excutor
                         if (request.configure.printid <= 0)
                         {
                             int _printid = 0;
-                            cmd.CommandText = @"SELECT MAX(printid) AS printid FROM u_configure_codemx WHERE pzid = @pzid";
+                            cmd.CommandText = @"SELECT ISNULL(MAX(printid),0) AS printid FROM u_configure_codemx WHERE pzid = @pzid";
                             cmd.Parameters.Clear();
                             cmd.Parameters.AddWithValue("@pzid", request.configure.pzid);
                             using (var reader = cmd.ExecuteReader())

+ 1 - 1
JLHHJSvr/GlobalVar/GlobalVar.cs

@@ -188,8 +188,8 @@ namespace JLHHJSvr
                 excutorManager.AddMap("DeleteConfigureCode", typeof(DeleteConfigureCodeRequest), new DeleteConfigureCodeExcutor());// 删除部件选配项
                 excutorManager.AddMap("SaveConfigureCodeMx", typeof(SaveConfigureCodeMxRequest), new SaveConfigureCodeMxExcutor());// 保存部件选配项值
                 excutorManager.AddMap("DeleteConfigureCodeMx", typeof(DeleteConfigureCodeMxRequest), new DeleteConfigureCodeMxExcutor());// 删除部件选配项值
-                excutorManager.AddMap("DeleteConfigureBomList", typeof(DeleteConfigureBomListRequest), new DeleteConfigureBomListExcutor());// 删除部件选配项值
                 excutorManager.AddMap("SaveConfigureBomList", typeof(SaveConfigureBomListRequest), new SaveConfigureBomListExcutor());// 删除部件选配项值
+                excutorManager.AddMap("DeleteConfigureBomList", typeof(DeleteConfigureBomListRequest), new DeleteConfigureBomListExcutor());// 删除部件选配项值
                 excutorManager.AddMap("GetMattressImportDW2", typeof(GetMattressImportDW2Request), new GetMattressImportDW2Excutor());// 下拉选择床垫类别
                 excutorManager.AddMap("SaveMattress", typeof(SaveMattressRequest), new SaveMattressExcutor());// 保存床垫报价
                 excutorManager.AddMap("SaveMattressAuditing", typeof(SaveMattressAuditingRequest), new SaveMattressAuditingExcutor());// 床垫报价:业务下单/取消

+ 7 - 12
JLHHJSvr/Helper/SoftBedHelper.cs

@@ -24,8 +24,8 @@ namespace JLHHJSvr.Helper
 		/// <param name="bill"></param>
         public u_softbed GetSoftBed(int billid,string fields = null)
         {
-            fields = fields ?? @"softbed_id,softbed_code,softbed_name,deptid,create_date,create_emp,mtrlmode,mtrltype,has_headboard,has_nightstand,has_bedframe,is_template,
-                                template_id,template_code,template_name,commission,taxes,other_rate,extras_cost,moneyrate,dscrp,costamt,nottax_factory_cost,nottax_dept_cost,
+            fields = fields ?? @"softbed_id,softbed_code,softbed_relcode,softbed_name,deptid,create_date,create_emp,mtrlmode,mtrltype,has_headboard,has_nightstand,has_bedframe,is_template,
+                                template_id,template_code,template_name,commission,taxes,taxrate,other_rate,extras_cost,moneyrate,dscrp,costamt,nottax_factory_cost,nottax_dept_cost,
                                 dept_cost,foreign_cost";
             var bill = new u_softbed() { softbed_id = billid };
 			if (DbSqlHelper.SelectOne(cmd, bill, fields) == 0) return null;
@@ -110,7 +110,7 @@ namespace JLHHJSvr.Helper
 			{
 				var resultList = new List<u_configure_codemxbom>();
 				var outputFields = @"pzid,printid,pid,mtrlid,sonscale,sonscale_formula,mng_cost_rate,profit_rate,realqty,cost,cost_emp,cost_date,sonloss,sonloss_formula,
-									sondecloss,sondecloss_formula,deptid_scll,price,price_formula,default_length,default_width,default_qty,mtrlcode,mtrlname,mtrlmode,unit,
+									sondecloss,sondecloss_formula,deptid_scll,default_length,default_width,default_qty,mtrlcode,mtrlname,mtrlmode,unit,
 									mtrlsectype,zxmtrlmode,usermtrlmode";
 				var selectStr = @"SELECT u_configure_codemxbom.pzid
 										,u_configure_codemxbom.printid
@@ -129,8 +129,6 @@ namespace JLHHJSvr.Helper
 										,u_configure_codemxbom.sondecloss
 										,u_configure_codemxbom.sondecloss_formula
 										,u_configure_codemxbom.deptid_scll
-										,u_configure_codemxbom.price
-										,u_configure_codemxbom.price_formula
 										,u_configure_codemxbom.default_length
 										,u_configure_codemxbom.default_width
 										,u_configure_codemxbom.default_qty
@@ -181,9 +179,6 @@ namespace JLHHJSvr.Helper
 				use_formula_str = bomItem.sonscale_formula,
 				actual_useqty = 0,
 				loss_rate = bomItem.sonloss,
-				price = bomItem.price,
-				price_formula = "",
-				price_formula_str = bomItem.price_formula,
 				cost_price = bomItem.cost,
 				cost_amt = 0
 			};
@@ -219,8 +214,8 @@ namespace JLHHJSvr.Helper
 
 			//
             var dtNow = context.opdate;
-			var fields = @"softbed_name,deptid,mtrlmode,mtrltype,has_headboard,has_nightstand,has_bedframe,is_template,
-                            template_id,template_code,template_name,commission,taxes,other_rate,extras_cost,moneyrate,dscrp,costamt,nottax_factory_cost,nottax_dept_cost,
+			var fields = @"softbed_relcode,softbed_name,deptid,mtrlmode,mtrltype,has_headboard,has_nightstand,has_bedframe,is_template,
+                            template_id,template_code,template_name,commission,taxes,taxrate,other_rate,extras_cost,moneyrate,dscrp,costamt,nottax_factory_cost,nottax_dept_cost,
                             dept_cost,foreign_cost";
 
 			var mx_fields = @"softbed_id,printid,pzid,pz_printid,mtrlid,mtrlname,mtrlcode,mtrlmode,unit,has_type,allow_edit,cutting_length,cutting_width,cutting_qty,
@@ -275,8 +270,8 @@ namespace JLHHJSvr.Helper
 		/// <param name="newId"></param>
         public void CopySoftBed(u_softbed softbed, out int newId)
         {
-			var fields = @"softbed_code,mtrlmode,mtrltype,has_headboard,has_nightstand,has_bedframe,is_template,
-                            template_id,template_code,template_name,commission,taxes,other_rate,extras_cost,moneyrate,dscrp";
+			var fields = @"mtrlmode,mtrltype,has_headboard,has_nightstand,has_bedframe,is_template,
+                            template_id,template_code,template_name,commission,taxes,taxrate,other_rate,extras_cost,moneyrate";
             var softbed_copy = GetSoftBed(softbed.softbed_id, fields);
 
 

+ 3 - 0
JLHWEB/src/api/interface/index.ts

@@ -1185,6 +1185,9 @@ export namespace Basicinfo {
   export interface ReqSaveConfigure {
     configure: any;
   }
+  export interface ReqSaveConfigureBom {
+    bomList: any[];
+  }
   export interface ReqGetMtrlDefList {
     pricelistid: number;
     mtrltypeids: number[];

+ 28 - 0
JLHWEB/src/api/modules/basicinfo.ts

@@ -464,6 +464,34 @@ export const DeleteConfigureCodeMx = (params: Basicinfo.ReqDeleteBasicinfo) => {
   return http.post<Basicinfo.ResDeleteBasicinfo>(PORT1 + `/DeleteConfigureCodeMx`, params);
 };
 
+/**
+ * @name 获取 部件选配项值用料清单
+ */
+export const getConfigureCodeMxBomList = (params: any) => {
+  let newParams: any = {};
+  newParams.dsname = "web_configure_codemxbomlist";
+  newParams.queryparams = params;
+  params.pageNum && (newParams.pageindex = params.pageNum);
+  params.pageSize && (newParams.pagesize = params.pageSize);
+  delete params.pageNum;
+  delete params.pageSize;
+  return CommonDynamicSelect(newParams, "web_configure_codemxbomlist");
+};
+
+/**
+ * @name 保存 部件选配项值用料清单
+ */
+export const SaveConfigureBomList = (params: Basicinfo.ReqSaveConfigureBom) => {
+  return http.post(PORT1 + `/SaveConfigureBomList`, params);
+};
+
+/**
+ * @name 删除 部件选配项值用料清单
+ */
+export const DeleteConfigureBomList = (params: Basicinfo.ReqDeleteBasicinfo) => {
+  return http.post<Basicinfo.ResDeleteBasicinfo>(PORT1 + `/DeleteConfigureBomList`, params);
+};
+
 /**
  * @name 上传 数据上传
  */

+ 4 - 0
JLHWEB/src/enums/dwnameEnum.ts

@@ -110,6 +110,10 @@ export enum DwnameEnum {
    * @description 床网分区定义
    */
   configurecodemxlist = "web_configure_codemxlist",
+  /*
+   * @description 床网分区定义
+   */
+  configurecodemxbomlist = "web_configure_codemxbomlist",
   /**
    *@description 床网报价表
    */

+ 50 - 1
JLHWEB/src/views/baseinfo/configure/detail.vue

@@ -44,6 +44,23 @@
     v-if="props.type === 2"
   >
   </LjDetail>
+  <LjDetail
+    name="configureCodeMxBomListRightDetail"
+    ref="LjDetailBottomRef"
+    v-bind="detailProps_bottom"
+    v-model:order-status="orderStatus"
+    :data="mainData"
+    :init-param="mainData[0]"
+    :if-fold-layout="false"
+    :if-layout-editable="false"
+    :search-col="{ xs: 4, sm: 4, md: 4, lg: 4, xl: 4 }"
+    :basic-group-col="{ xs: 4, sm: 4, md: 4, lg: 4, xl: 4 }"
+    :enum="props.enum"
+    v-if="props.type === 3"
+  >
+  </LjDetail>
+
+  <MtrldefDialog ref="MtrldefDialogRef" v-bind="MtrldefDialogProps" />
 </template>
 
 <script setup lang="tsx" name="configureTypeListDetail">
@@ -54,6 +71,7 @@ import { DetailProp } from "@/components/LjDetail/interface";
 import { useI18n } from "vue-i18n";
 import { useHooks } from "./hooks/index";
 import { useAuthButtons } from "@/hooks/useAuthButtons";
+import MtrldefDialog from "@/views/system/selector/mtrldefNoPrice/index.vue";
 
 interface detailProp {
   /**
@@ -78,7 +96,18 @@ interface detailProp {
 
 const props = withDefaults(defineProps<detailProp>(), {});
 const { t } = useI18n();
-const { LjDetailLeftRef, LjDetailMidRef, LjDetailRightRef, columns_left, columns_mid, columns_right } = useHooks(t);
+const {
+  LjDetailLeftRef,
+  LjDetailMidRef,
+  LjDetailRightRef,
+  LjDetailBottomRef,
+  columns_left,
+  columns_mid,
+  columns_right,
+  columns_bottom,
+  MtrldefDialogRef,
+  MtrldefDialogProps
+} = useHooks(t);
 const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
 
 const mainData = ref([{}]);
@@ -147,6 +176,26 @@ const detailProps_right = reactive<DetailProp>({
   mould: []
 });
 
+const detailProps_bottom = reactive<DetailProp>({
+  dwname: DwnameEnum.configurecodemxbomlist,
+  columns: columns_bottom,
+  // addPower: 5,
+  // editPower: 4359,
+  header: {
+    fieldNames: {
+      code: "deptname",
+      codeLabel: t("table.u_cust.cuscode") + ":",
+      name: "name"
+    },
+    icon: "iconuser-01",
+    tabsProp: {
+      scrollspy: false,
+      sticky: true
+    }
+  },
+  mould: []
+});
+
 watch(
   () => props.data,
   val => {

+ 321 - 7
JLHWEB/src/views/baseinfo/configure/hooks/index.tsx

@@ -1,4 +1,4 @@
-import { ref, reactive, computed, toRefs } from "vue";
+import { ref, reactive, nextTick, toRefs } from "vue";
 import { Table } from "@/hooks/interface";
 import { ColumnProps } from "@/components/LjVxeTable/interface";
 import { ALLOW_EDIT_STATE } from "@/config/index";
@@ -6,14 +6,16 @@ import {
   SaveConfigureType,
   SaveConfigureCode,
   SaveConfigureCodeMx,
+  SaveConfigureBomList,
   DeleteConfigureType,
   DeleteConfigureCode,
   DeleteConfigureCodeMx,
-  CopyConfigureCodeMxList
+  CopyConfigureCodeMxList,
+  DeleteConfigureBomList
 } from "@/api/modules/basicinfo";
 import { ElMessage, ElMessageBox } from "element-plus";
-import { localSet, localGet } from "@/utils/index";
 import { useClipboardStore } from "@/stores/modules/copy";
+import MtrldefSelect from "@/views/system/selector/mtrldefNoPrice/select.vue";
 interface defaultState {
   /**
    * @description 单据当前状态
@@ -31,6 +33,10 @@ interface defaultState {
    * @description 列表Ref
    */
   VxeTableRightRef: any;
+  /**
+   * @description 列表Ref
+   */
+  VxeTableBottomRef: any;
   /**
    * @description 详情页Ref
    */
@@ -43,10 +49,16 @@ interface defaultState {
    * @description 详情页Ref
    */
   LjDetailRightRef: any;
+  /**
+   * @description 详情页Ref
+   */
+  LjDetailBottomRef: any;
   /**
    * @description 详情页明细表格Ref
    */
   VxeTableMxRef: any;
+  MtrldefDialogRef: any;
+  MtrldefDialogProps: any;
 }
 
 const state = reactive<defaultState>({
@@ -54,10 +66,14 @@ const state = reactive<defaultState>({
   VxeTableLeftRef: null,
   VxeTableMidRef: null,
   VxeTableRightRef: null,
+  VxeTableBottomRef: null,
   LjDetailLeftRef: null,
   LjDetailMidRef: null,
   LjDetailRightRef: null,
-  VxeTableMxRef: null
+  LjDetailBottomRef: null,
+  VxeTableMxRef: null,
+  MtrldefDialogRef: null,
+  MtrldefDialogProps: {}
 });
 const ClipboardStore = useClipboardStore();
 const COPY_KEY = "configure_codemx";
@@ -294,16 +310,261 @@ export const useHooks = (t?: any) => {
     }
   ];
 
+  const columns_bottom: ColumnProps<any>[] = [
+    {
+      field: "mtrlname",
+      title: "物料名称",
+      basicinfo: {
+        el: "select",
+        span: 3,
+        row: 1,
+        order: 1,
+        editable: ALLOW_EDIT_STATE,
+        render: (scope: any) => {
+          const { column, searchParam: row, status } = scope;
+          let params = {};
+          return (
+            <>
+              <MtrldefSelect
+                value={row.mtrlid}
+                {...params}
+                clearable
+                placeholder={row.mtrlname}
+                onOpenModal={() => fModelChoseMtrl(row, params)}
+                onSelect={(val: any) => rModelSetMtrl(row, val)}
+                onClear={() => rModelClearMtrl(scope.searchParam)}
+              >
+                {{
+                  label: () => row.mtrlname
+                }}
+              </MtrldefSelect>
+            </>
+          );
+        }
+      }
+    },
+    {
+      field: "unit",
+      title: "单位",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 2
+      }
+    },
+    {
+      field: "default_length",
+      title: "默认长",
+      basicinfo: {
+        el: "input",
+        span: 2,
+        row: 1,
+        order: 5,
+        editable: ALLOW_EDIT_STATE
+      }
+    },
+    {
+      field: "default_width",
+      title: "默认宽",
+      basicinfo: {
+        el: "input",
+        span: 2,
+        row: 1,
+        order: 6,
+        editable: ALLOW_EDIT_STATE
+      }
+    },
+    {
+      field: "default_qty",
+      title: "默认数量",
+      basicinfo: {
+        el: "input",
+        span: 2,
+        row: 1,
+        order: 7,
+        editable: ALLOW_EDIT_STATE
+      }
+    },
+    {
+      field: "sonscale",
+      title: "用料量",
+      basicinfo: {
+        el: "input",
+        span: 2,
+        row: 1,
+        order: 8,
+        editable: ALLOW_EDIT_STATE
+      }
+    },
+    {
+      field: "mng_cost_rate",
+      title: "管理费用率",
+      basicinfo: {
+        el: "input",
+        span: 2,
+        row: 1,
+        order: 9,
+        editable: ALLOW_EDIT_STATE
+      }
+    },
+    {
+      field: "profit_rate",
+      title: "利润率",
+      basicinfo: {
+        el: "input",
+        span: 2,
+        row: 1,
+        order: 10,
+        editable: ALLOW_EDIT_STATE
+      }
+    },
+    {
+      field: "sonloss",
+      title: "损耗率",
+      basicinfo: {
+        el: "input",
+        span: 2,
+        row: 1,
+        order: 11,
+        editable: ALLOW_EDIT_STATE
+      }
+    },
+    {
+      field: "sondecloss",
+      title: "损附加",
+      basicinfo: {
+        el: "input",
+        span: 2,
+        row: 1,
+        order: 12,
+        editable: ALLOW_EDIT_STATE
+      }
+    },
+    {
+      field: "sonscale_formula",
+      title: "用料量公式",
+      basicinfo: {
+        el: "input",
+        span: 4,
+        row: 1,
+        order: 13,
+        editable: ALLOW_EDIT_STATE,
+        props: { type: "textarea", rows: 3 }
+      }
+    },
+    {
+      field: "sonloss_formula",
+      title: "损耗率公式",
+      basicinfo: {
+        el: "input",
+        span: 4,
+        row: 1,
+        order: 14,
+        editable: ALLOW_EDIT_STATE,
+        props: { type: "textarea", rows: 3 }
+      }
+    },
+    {
+      field: "sondecloss_formula",
+      title: "损附加公式",
+      basicinfo: {
+        el: "input",
+        span: 4,
+        row: 1,
+        order: 15,
+        editable: ALLOW_EDIT_STATE,
+        props: { type: "textarea", rows: 3 }
+      }
+    },
+    {
+      field: "cost",
+      title: "成本价",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 16,
+        visible: false
+      }
+    },
+    {
+      field: "cost_emp",
+      title: "成本价统计人",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 17,
+        visible: false
+      }
+    },
+    {
+      field: "cost_date",
+      title: "成本价统计时间",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 18,
+        visible: false
+      }
+    },
+    {
+      field: "realqty",
+      title: "物料清单总用量",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 19,
+        visible: false
+      }
+    },
+    {
+      field: "deptid_scll",
+      title: "默认领用部门",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 20,
+        visible: false
+      }
+    }
+  ];
+
   const getSaveFun = (type: Number) => {
-    return type === 2 ? SaveConfigureCodeMx : type === 1 ? SaveConfigureCode : SaveConfigureType;
+    switch (type) {
+      case 0:
+        return SaveConfigureType;
+      case 1:
+        return SaveConfigureCode;
+      case 2:
+        return SaveConfigureCodeMx;
+      case 3:
+        return SaveConfigureBomList;
+    }
   };
 
   const getDelFun = (type: Number) => {
-    return type === 2 ? DeleteConfigureCodeMx : type === 1 ? DeleteConfigureCode : DeleteConfigureType;
+    switch (type) {
+      case 0:
+        return DeleteConfigureType;
+      case 1:
+        return DeleteConfigureCode;
+      case 2:
+        return DeleteConfigureCodeMx;
+      case 3:
+        return DeleteConfigureBomList;
+    }
   };
 
   const getTableRef = (type: Number) => {
-    return type === 2 ? state.VxeTableRightRef : type === 1 ? state.VxeTableMidRef : state.VxeTableLeftRef;
+    switch (type) {
+      case 0:
+        return state.VxeTableLeftRef;
+      case 1:
+        return state.VxeTableMidRef;
+      case 2:
+        return state.VxeTableRightRef;
+      case 3:
+        return state.VxeTableBottomRef;
+    }
   };
 
   // 保存
@@ -448,11 +709,64 @@ export const useHooks = (t?: any) => {
     }
   };
 
+  /**
+   * @description 弹窗模块:客户选择
+   * @param data 当前数据
+   * @param status 当前订单状态
+   * @returns Promise
+   */
+  const fModelChoseMtrl = (data: any, params: any) => {
+    return new Promise((resolve, reject) => {
+      // if (!ALLOW_EDIT_STATE.includes(status)) return;
+
+      let _params = {
+        keyword: ""
+      };
+      state.MtrldefDialogProps = {
+        onSubmit: (res: any) => {
+          // submit
+          console.log("openCustDialog res", res);
+          nextTick(() => {
+            rModelSetMtrl(data, res.value[0]);
+            resolve(1);
+          });
+        },
+        onCancel: (error: any) => {
+          // cancel 回调
+          console.log("openCustDialog error", error);
+        }
+      };
+      state.MtrldefDialogRef.show(_params);
+    });
+  };
+
+  /**
+   * @description 数据赋值: 联系人
+   * @param data 当前数据
+   * @param item 当前选择的数据
+   */
+  const rModelSetMtrl = (data: any, item: any) => {
+    data.mtrlid = Number(item.mtrlid);
+    data.mtrlname = item.name;
+    // data.mtrlcode = item.mtrlcode;
+    // data.mtrlmode = item.mtrlmode;
+    data.unit = item.priceunit;
+  };
+
+  const rModelClearMtrl = (data: any) => {
+    data.mtrlid = 0;
+    data.mtrlname = "";
+    data.mtrlcode = "";
+    data.mtrlmode = "";
+    data.unit = "";
+  };
+
   return {
     ...toRefs(state),
     columns_left,
     columns_mid,
     columns_right,
+    columns_bottom,
     fSave,
     fDelete,
     fCopy,

+ 122 - 44
JLHWEB/src/views/baseinfo/configure/index.vue

@@ -80,26 +80,23 @@
             <template #right>
               <div class="main-box flx-col">
                 <LjVxeTable
-                  ref="VxeTableRightRef"
+                  ref="VxeTableBottomRef"
                   row-key="pzid"
-                  :columns="columns_right"
-                  :request-api="getCodeMxData"
-                  :data-callback="callback_right"
-                  :dwname="dwname_right"
+                  :columns="columns_bottom"
+                  :request-api="getCodeMxBomData"
+                  :data-callback="callback_bottom"
+                  :dwname="dwname_bottom"
                   :table-props="tableProps"
-                  :table-events="tableEvents_right"
-                  :init-param="initParams_right"
+                  :table-events="tableEvents_bottom"
+                  :init-param="initParams_bottom"
                   :auto-load-layout="false"
                   pagination
                 >
                   <!-- 表格 header 按钮 -->
                   <template #tableHeader>
                     <el-button-group>
-                      <el-button @click="handleOpenNewRightTable">{{ $t("common.add") }}</el-button>
+                      <el-button @click="handleOpenNewBottomTable">{{ $t("common.add") }}</el-button>
                       <el-button @click="fDelete(2)">{{ $t("common.delText") }}</el-button>
-                      <el-button @click="fCopy">{{ $t("common.copy") }}</el-button>
-                      <el-button @click="fPaste(0)">{{ $t("common.supplyPaste") }}</el-button>
-                      <el-button @click="fPaste(1)">{{ $t("common.coverPaste") }}</el-button>
                     </el-button-group>
                   </template>
                 </LjVxeTable>
@@ -128,7 +125,12 @@
 
 <script setup lang="ts" name="baseinfo_configurelist">
 import { ref, onMounted, provide } from "vue";
-import { getConfigureTypeList, getConfigureCodeList, getConfigureCodeMxList } from "@/api/modules/basicinfo";
+import {
+  getConfigureTypeList,
+  getConfigureCodeList,
+  getConfigureCodeMxList,
+  getConfigureCodeMxBomList
+} from "@/api/modules/basicinfo";
 import Detail from "./detail.vue";
 import { useHooks } from "./hooks/index";
 import LjDialog from "@/components/LjDialog/index.vue";
@@ -148,6 +150,7 @@ const dwname_bottom = "web_configure_bomlist";
 const mainData = ref({});
 const initParams_mid = ref({ typeid: 0 as Number });
 const initParams_right = ref({ pzid: 0 as Number, typeid: 0 as Number });
+const initParams_bottom = ref({ pzid: 0 as Number, printid: 0 as Number });
 const detailType = ref(0);
 const tableProps = {
   height: "auto",
@@ -180,12 +183,15 @@ const {
   VxeTableLeftRef,
   VxeTableMidRef,
   VxeTableRightRef,
+  VxeTableBottomRef,
   LjDetailLeftRef,
   LjDetailMidRef,
   LjDetailRightRef,
+  LjDetailBottomRef,
   columns_left,
   columns_mid,
   columns_right,
+  columns_bottom,
   fSave,
   fDelete,
   fCopy,
@@ -206,23 +212,47 @@ const orderDefaultAction = [
     label: t("common.saveText"),
     icon: "iconsave-01",
     clickFunc: item => {
-      let save_data =
-        detailType.value === 2
-          ? LjDetailRightRef.value?._mainData
-          : detailType.value === 1
-          ? LjDetailMidRef.value?._mainData
-          : LjDetailLeftRef.value?._mainData;
+      let save_data = null;
+      switch (detailType.value) {
+        case 0:
+          save_data = LjDetailLeftRef.value?._mainData;
+          break;
+        case 1:
+          save_data = LjDetailMidRef.value?._mainData;
+          break;
+        case 2:
+          save_data = LjDetailRightRef.value?._mainData;
+          break;
+        case 3:
+          save_data = LjDetailBottomRef.value?._mainData;
+          break;
+      }
       if (orderStatus.value == "new") {
-        save_data =
-          detailType.value === 2
-            ? LjDetailRightRef.value?.infoParam
-            : detailType.value === 1
-            ? LjDetailMidRef.value?.infoParam
-            : LjDetailLeftRef.value?.infoParam;
+        switch (detailType.value) {
+          case 0:
+            save_data = LjDetailLeftRef.value?.infoParam;
+            break;
+          case 1:
+            save_data = LjDetailMidRef.value?.infoParam;
+            break;
+          case 2:
+            save_data = LjDetailRightRef.value?.infoParam;
+            break;
+          case 3:
+            save_data = LjDetailBottomRef.value?.infoParam;
+            break;
+        }
+      }
+
+      if (detailType.value === 3) {
+        fSave(detailType.value, { bomList: [save_data] }).then(() => {
+          LjDrawerRef.value.hide();
+        });
+      } else {
+        fSave(detailType.value, { configure: save_data }).then(() => {
+          LjDrawerRef.value.hide();
+        });
       }
-      fSave(detailType.value, { configure: save_data }).then(() => {
-        LjDrawerRef.value.hide();
-      });
     }
   })
 ];
@@ -231,23 +261,31 @@ const orderEditAction = [
     label: t("common.saveText"),
     icon: "iconsave-01",
     clickFunc: item => {
-      let save_data =
-        detailType.value === 2
-          ? LjDetailRightRef.value?._mainData
-          : detailType.value === 1
-          ? LjDetailMidRef.value?._mainData
-          : LjDetailLeftRef.value?._mainData;
-      if (orderStatus.value == "new") {
-        save_data =
-          detailType.value === 2
-            ? LjDetailRightRef.value?._mainData
-            : detailType.value === 1
-            ? LjDetailMidRef.value?._mainData
-            : LjDetailLeftRef.value?._mainData;
+      let save_data = null;
+      switch (detailType.value) {
+        case 0:
+          save_data = LjDetailLeftRef.value?._mainData;
+          break;
+        case 1:
+          save_data = LjDetailMidRef.value?._mainData;
+          break;
+        case 2:
+          save_data = LjDetailRightRef.value?._mainData;
+          break;
+        case 3:
+          save_data = LjDetailBottomRef.value?._mainData;
+          break;
+      }
+
+      if (detailType.value === 3) {
+        fSave(detailType.value, { bomList: [Object.assign({}, mainData.value, save_data)] }).then(() => {
+          LjDrawerRef.value.hide();
+        });
+      } else {
+        fSave(detailType.value, { configure: Object.assign({}, mainData.value, save_data) }).then(() => {
+          LjDrawerRef.value.hide();
+        });
       }
-      fSave(detailType.value, { configure: Object.assign({}, mainData.value, save_data) }).then(() => {
-        LjDrawerRef.value.hide();
-      });
     }
   })
 ];
@@ -274,6 +312,10 @@ const getCodeMxData = (params: any) => {
   return getConfigureCodeMxList(params);
 };
 
+const getCodeMxBomData = (params: any) => {
+  return getConfigureCodeMxBomList(params);
+};
+
 const callback_left = (data: any) => {
   // 选中第一列
   if (data.datatable && data.datatable.length) {
@@ -294,6 +336,15 @@ const callback_mid = (data: any) => {
 };
 
 const callback_right = (data: any) => {
+  if (data.datatable && data.datatable.length) {
+    let row = data.datatable[0];
+    initParams_bottom.value.pzid = Number(row.pzid);
+    initParams_bottom.value.printid = Number(row.printid);
+  }
+  return dataCallback(data);
+};
+
+const callback_bottom = (data: any) => {
   return dataCallback(data);
 };
 
@@ -339,6 +390,14 @@ const handleDBlClickRightTable = ({ row, rowIndex, $rowIndex, column, columnInde
   LjDrawerRef.value.show();
 };
 
+const handleDBlClickBottomTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event }: any) => {
+  // 弹窗
+  mainData.value = cloneDeep(row);
+  detailType.value = 3;
+  orderStatus.value = "edit";
+  LjDrawerRef.value.show();
+};
+
 const handleOpenNewLeftTable = () => {
   mainData.value = {
     contfigtypeid: 0
@@ -368,6 +427,16 @@ const handleOpenNewRightTable = () => {
   LjDrawerRef.value.show();
 };
 
+const handleOpenNewBottomTable = () => {
+  mainData.value = {
+    pzid: initParams_bottom.value.pzid,
+    printid: initParams_bottom.value.printid
+  };
+  detailType.value = 3;
+  orderStatus.value = "new";
+  LjDrawerRef.value.show();
+};
+
 const handleClickLeftTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event }: any) => {
   initParams_mid.value.typeid = Number(row.contfigtypeid);
 };
@@ -377,6 +446,11 @@ const handleClickMidTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $c
   initParams_right.value.typeid = Number(row.typeid);
 };
 
+const handleClickRightTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event }: any) => {
+  initParams_bottom.value.pzid = Number(row.pzid);
+  initParams_bottom.value.printid = Number(row.printid);
+};
+
 const tableEvents_left = {
   "cell-dblclick": handleDBlClickLeftTable,
   "cell-click": handleClickLeftTable
@@ -387,7 +461,11 @@ const tableEvents_mid = {
 };
 // 返回绑定的事件
 const tableEvents_right = {
-  "cell-dblclick": handleDBlClickRightTable
+  "cell-dblclick": handleDBlClickRightTable,
+  "cell-click": handleClickRightTable
+};
+const tableEvents_bottom = {
+  "cell-dblclick": handleDBlClickBottomTable
   // "cell-click": handleClickTable
 };
 </script>

+ 27 - 55
JLHWEB/src/views/quote/softbedQuote/detail.vue

@@ -81,12 +81,16 @@ const {
   headBoardMx,
   nightStandMx,
   bedFrameMx,
-  detail_getData
+  detail_getData,
+  onAudit,
+  onCAudit,
+  onDelete
 } = useHooks(t);
 const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
 
 const initParams = ref({ billid: 0 as Number });
 
+const tabRemove: Function = inject("tabRemove") as Function;
 const { userInfo } = useUserStore();
 const loadingStatus = reactive({
   save: false,
@@ -142,7 +146,7 @@ const detailProps = reactive<DetailProp>({
       label: "床头",
       limited: (params: any) => {
         if (!params) return true;
-        return params?.has_headboard == 1;
+        return params?.has_headboard === 0;
       }
     },
     {
@@ -151,7 +155,7 @@ const detailProps = reactive<DetailProp>({
       label: "床头柜",
       limited: (params: any) => {
         if (!params) return true;
-        return params?.has_nightstand == 1;
+        return params?.has_nightstand === 0;
       }
     },
     {
@@ -160,7 +164,7 @@ const detailProps = reactive<DetailProp>({
       label: "床架",
       limited: (params: any) => {
         if (!params) return true;
-        return params?.has_bedframe == 1;
+        return params?.has_bedframe === 0;
       }
     }
   ]
@@ -175,7 +179,7 @@ const orderDefaultAction = [
     },
     clickFunc: item => {
       if (route.path.indexOf("/new") > -1) {
-        // tabRemove(route.fullPath);
+        tabRemove(route.fullPath);
         router.replace("/softbedQuote");
       } else {
         router.replace(
@@ -238,18 +242,11 @@ const orderDefaultAction = [
       return "";
     },
     clickFunc: item => {
-      ElMessageBox.confirm("是否确定要删除床垫报价单吗?", "询问", {
-        confirmButtonText: t("common.delText"),
-        cancelButtonText: "否",
-        type: "error"
-      })
-        .then(() => {})
-        .catch((e: TypeError) => {
-          ElMessage({
-            type: "info",
-            message: "操作取消"
-          });
-        });
+      const list = [{ softbed_id: softBed.value.softbed_id }];
+      onDelete(list, () => {
+        tabRemove(route.fullPath);
+        router.replace("/mattressQuote");
+      });
     }
   }),
   buttonDefault({
@@ -268,18 +265,8 @@ const orderDefaultAction = [
       return "";
     },
     clickFunc: item => {
-      ElMessageBox.confirm(`是否确定要${t("common.auditText")}吗?`, "询问", {
-        confirmButtonText: "是",
-        cancelButtonText: "否",
-        type: "warning"
-      })
-        .then(() => {})
-        .catch((e: TypeError) => {
-          ElMessage({
-            type: "info",
-            message: "操作取消"
-          });
-        });
+      const list = [{ softbed_id: softBed.value.softbed_id }];
+      onAudit(list);
     }
   }),
   buttonDefault({
@@ -298,30 +285,8 @@ const orderDefaultAction = [
       return "";
     },
     clickFunc: item => {
-      ElMessageBox.confirm(`是否确定要${t("common.withdrawAuditText")}吗?`, "询问", {
-        confirmButtonText: "是",
-        cancelButtonText: "否",
-        type: "warning"
-      })
-        .then(() => {})
-        .catch((e: TypeError) => {
-          ElMessage({
-            type: "info",
-            message: "操作取消"
-          });
-        });
-    }
-  }),
-  buttonDefault({
-    label: t("common.copyQuote"),
-    power: 75,
-    limited: () => {
-      return !!orderStatus.value;
-    },
-    clickFunc: item => {
-      router.push(
-        `/softbedQuote/copy?id=${LjDetailRef.value._mainData.softbed_id}&code=${LjDetailRef.value._mainData.softbed_code}`
-      );
+      const list = [{ softbed_id: softBed.value.softbed_id }];
+      onCAudit(list);
     }
   }),
   buttonDefault({
@@ -347,7 +312,7 @@ const orderDefaultAction = [
  * @description 页面数据加载完成
  */
 const funcAfterMound = async (data: any) => {
-  console.log("onMounted detail start!!!! :>> ", orderStatus.value, data);
+  console.log("onMounted detail start!!!! :>> ", orderStatus.value, data, route, router);
   if (!orderStatus.value) {
     // 详情页
   } else {
@@ -356,9 +321,16 @@ const funcAfterMound = async (data: any) => {
   }
 
   if (orderStatus.value != "new") {
-    initParams.value.billid = 1;
+    initParams.value.billid = Number(route.query.id);
   }
 
   detail_getData(initParams.value);
 };
 </script>
+<style lang="scss">
+.select-text-right {
+  .el-select__wrapper {
+    text-align: right;
+  }
+}
+</style>

+ 764 - 47
JLHWEB/src/views/quote/softbedQuote/hooks/index.tsx

@@ -1,6 +1,11 @@
 import { ref, reactive, computed, toRefs, nextTick } from "vue";
 import { ColumnProps } from "@/components/LjVxeTable/interface";
 import { GetSoftBedMxList } from "@/api/modules/quote";
+import { ALLOW_EDIT_STATE } from "@/config/index";
+import { ElButton, ElMessage, ElMessageBox, ElRow, ElCol } from "element-plus";
+import { AuditSoftBedQuote, DeleteSoftBedQuote } from "@/api/modules/quote";
+import { getDeptList } from "@/api/modules/saleprice";
+import { CommonDynamicSelect } from "@/api/modules/common";
 interface defaultState {
   /**
    * @description 单据当前状态
@@ -18,6 +23,7 @@ interface defaultState {
    * @description 详情页明细表格Ref
    */
   VxeTableMxRef: any;
+  initParams: any;
   /**
    * @description 详情页主表数据
    */
@@ -54,134 +60,719 @@ export const useHooks = (t?: any) => {
     softBedMx: null,
     headBoardMx: null,
     nightStandMx: null,
-    bedFrameMx: null
+    bedFrameMx: null,
+    initParams: { arg_softbed_id: 0 }
   });
   // 表格配置项
   const columns: ColumnProps<any>[] = [
+    { type: "checkbox", width: 40, fixed: "left" },
     {
       field: "pid",
-      title: "序"
+      title: "序",
+      width: 40,
+      basicinfo: {
+        span: 1,
+        row: 1
+      }
     },
     {
       field: "softbed_code",
-      title: "软床报价编码"
-    },
-    {
-      field: "softbed_name",
-      title: "软床报价名称"
+      title: "报价唯一码",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 1,
+        group: "单据信息"
+      }
     },
     {
       field: "deptid",
-      title: "部门"
+      title: "部门",
+      enum: () =>
+        getDeptList({}).then(res => {
+          return res.datatable;
+        }),
+      fieldNames: { label: "deptname", value: "deptid" },
+      search: {
+        el: "select",
+        key: "arg_deptid",
+        props: {
+          filterable: true,
+          onChange: val => {
+            state.initParams.arg_deptid = val;
+          }
+        },
+        order: 1
+      },
+      basicinfo: {
+        el: "select",
+        span: 1,
+        row: 1,
+        order: 1,
+        group: "单据信息",
+        editable: (scope: any) => {
+          if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.softbed_id) <= 0) {
+            return true;
+          }
+          return false;
+        },
+        rules: [{ required: true, message: "请先选择部门", trigger: "change" }],
+        props: {
+          filterable: true,
+          clearable: false,
+          onChange: val => {
+            wf_get_moneyrate_discount(val);
+          }
+        }
+      }
     },
     {
-      field: "flag",
-      title: "审核"
+      field: "is_template",
+      title: "模板报价",
+      datatype: "checkbox",
+      basicinfo: {
+        el: "checkbox",
+        span: 1,
+        row: 1,
+        order: 2,
+        group: "单据信息"
+      }
     },
     {
       field: "create_date",
-      title: "报价日期"
+      title: "报价日期",
+      format: "yyyy-MM-dd HH:mm",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 3,
+        group: "单据信息"
+      }
     },
     {
-      field: "create_emp",
-      title: "报价人"
+      field: "template_code",
+      title: "模板编号",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 4,
+        group: "单据信息",
+        editable: (scope: any) => {
+          if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.is_template)) {
+            return true;
+          }
+          return false;
+        }
+      }
+    },
+    {
+      field: "softbed_name",
+      title: "报价名称",
+      basicinfo: {
+        el: "input",
+        span: 1,
+        row: 1,
+        order: 5,
+        group: "单据信息",
+        editable: ALLOW_EDIT_STATE
+      }
+    },
+    {
+      field: "template_name",
+      title: "模板名称",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 6,
+        group: "单据信息",
+        editable: (scope: any) => {
+          if (ALLOW_EDIT_STATE.includes(scope.status) && Number(scope.searchParam.is_template)) {
+            return true;
+          }
+          return false;
+        }
+      }
+    },
+    {
+      field: "softbed_relcode",
+      title: "报价编码",
+      basicinfo: {
+        el: "input",
+        span: 1,
+        row: 1,
+        order: 7,
+        group: "单据信息",
+        editable: ALLOW_EDIT_STATE
+      }
     },
     {
       field: "mtrlmode",
-      title: "物料规格"
+      title: "物料规格",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 8,
+        group: "单据信息"
+      }
+    },
+    {
+      field: "create_emp",
+      title: "报价人",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 9,
+        group: "单据信息"
+      }
     },
     {
       field: "mtrltype",
-      title: "物料类别"
+      title: "物料类别",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 10,
+        group: "单据信息"
+      }
+    },
+    {
+      field: "has_type",
+      title: "类型",
+      visible: false,
+      basicinfo: {
+        span: 2,
+        row: 1,
+        order: 10,
+        group: "单据信息",
+        labelHidden: true,
+        render: (scope: any) => {
+          let _disabled = !ALLOW_EDIT_STATE.includes(state.orderStatus);
+          let _type = _disabled ? "info" : "primary";
+          return (
+            <>
+              <ElRow>
+                <ElCol span={16}>
+                  <el-checkbox
+                    v-model={scope.searchParam.has_headboard}
+                    true-value={1}
+                    false-value={0}
+                    disabled={_disabled}
+                    label="床头"
+                    class="mr-8"
+                    // onChange={val => autoLoadExtraData_chai(val, "if_m_chai")}
+                  />
+                  <el-checkbox
+                    v-model={scope.searchParam.has_nightstand}
+                    true-value={1}
+                    false-value={0}
+                    disabled={_disabled}
+                    label="床头柜"
+                    class="mr-8"
+                    // onChange={val => autoLoadExtraData_chai(val, "if_z_chai")}
+                  />
+                  <el-checkbox
+                    v-model={scope.searchParam.has_bedframe}
+                    true-value={1}
+                    false-value={0}
+                    disabled={_disabled}
+                    label="床架"
+                    // onChange={val => autoLoadExtraData_chai(val, "if_d_chai")}
+                  />
+                </ElCol>
+                <ElCol span={8}>
+                  <ElButton type={_type} size="small" disabled={_disabled} onClick={onOpenConfigureDialog}>
+                    选择部件配置
+                  </ElButton>
+                </ElCol>
+              </ElRow>
+            </>
+          );
+        }
+      }
     },
     {
       field: "has_headboard",
-      title: "床头"
+      width: 44,
+      align: "center",
+      title: "床头",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 10,
+        group: "单据信息",
+        visible: false
+      }
     },
     {
       field: "has_nightstand",
-      title: "床头柜"
+      width: 58,
+      align: "center",
+      title: "床头柜",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 11,
+        group: "单据信息",
+        visible: false
+      }
     },
     {
       field: "has_bedframe",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 12,
+        group: "单据信息",
+        visible: false
+      },
+      width: 44,
+      align: "center",
       title: "床架"
     },
     {
-      field: "is_template",
-      title: "模板报价"
+      field: "other_rate",
+      format: "cutNumber",
+      basicinfo: {
+        el: "input-number",
+        span: 1,
+        row: 1,
+        order: 19,
+        group: "费用信息",
+        editable: ALLOW_EDIT_STATE
+      },
+      title: "额外点数"
     },
     {
-      field: "template_code",
-      title: "模板编号"
+      field: "taxes",
+      title: "税金",
+      format: "cutNumber",
+      enum: [
+        {
+          label: "不含税",
+          value: 1
+        },
+        {
+          label: "含税",
+          value: 1.07
+        }
+      ],
+      basicinfo: {
+        el: "select",
+        span: 1,
+        row: 1,
+        order: 20,
+        group: "费用信息",
+        editable: ALLOW_EDIT_STATE,
+        render: (scope: any) => {
+          let optionRender = [];
+          let _disabled = !ALLOW_EDIT_STATE.includes(scope.status);
+          scope.enum.map(item => {
+            optionRender.push(<el-option label={item.label} value={item.value} />);
+          });
+          let slotprefix = {
+            prefix: () => {
+              return <>{scope.searchParam.taxrate}</>;
+            }
+          };
+
+          let _taxrate = Number(scope.searchParam.taxrate);
+          return (
+            <el-select
+              v-model={_taxrate}
+              v-slots={slotprefix}
+              class="select-text-right"
+              disabled={_disabled}
+              onChange={val => funcTaxrateChange(val, scope.searchParam)}
+            >
+              {optionRender}
+            </el-select>
+          );
+        }
+      }
     },
     {
-      field: "template_name",
-      title: "模板名称"
+      field: "extras_cost",
+      format: "cutNumber",
+      basicinfo: {
+        el: "input-number",
+        span: 1,
+        row: 1,
+        order: 21,
+        group: "费用信息",
+        editable: ALLOW_EDIT_STATE
+      },
+      title: "额外费用"
+    },
+    {
+      field: "moneyrate",
+      title: "币种",
+      enum: () => {
+        return GetMoneyRateMapper().then(res => {
+          return res.datatable;
+        });
+      },
+      render: (scope: any) => {
+        return (
+          <>
+            <div class="flx-justify-between">
+              <span>
+                <>{scope.row.moneyrate > 1 ? `美元` : "人民币"}</>
+              </span>
+              {scope.row.moneyrate > 1 && (
+                <span>
+                  <>{scope.row.moneyrate}</>
+                </span>
+              )}
+            </div>
+          </>
+        );
+      },
+      basicinfo: {
+        el: "select",
+        span: 1,
+        row: 1,
+        order: 22,
+        group: "费用信息",
+        editable: ALLOW_EDIT_STATE,
+        render: (scope: any) => {
+          let optionRender = [];
+          let _disabled = !ALLOW_EDIT_STATE.includes(scope.status);
+          scope.enum.map(item => {
+            optionRender.push(<el-option label={item.label} value={item.value} />);
+          });
+          let slotprefix = {
+            prefix: () => {
+              return <>{scope.searchParam.moneyrate}</>;
+            }
+          };
+
+          return (
+            <el-select
+              v-model={scope.searchParam.if_moneyrate}
+              v-slots={slotprefix}
+              class="select-text-right"
+              disabled={_disabled}
+              onChange={val => wf_get_moneyrate_discount(val)}
+            >
+              {optionRender}
+            </el-select>
+          );
+        }
+      }
     },
     {
       field: "commission",
+      format: "cutNumber",
+      basicinfo: {
+        el: "input-number",
+        span: 1,
+        row: 1,
+        order: 23,
+        group: "费用信息",
+        editable: ALLOW_EDIT_STATE
+      },
       title: "佣金"
     },
     {
-      field: "taxes",
-      title: "税金"
+      field: "dscrp",
+      title: "备注",
+      basicinfo: {
+        el: "input",
+        editable: ALLOW_EDIT_STATE,
+        span: 1,
+        row: 1,
+        order: 24,
+        group: "费用信息",
+        props: {
+          type: "textarea"
+        }
+      }
     },
     {
-      field: "other_rate",
-      title: "额外点数"
+      field: "foreign_cost",
+      format: "cutNumber",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 25,
+        group: "报价信息",
+        visible: true,
+        ishidden: false
+      },
+      title: "外币价"
     },
     {
-      field: "extras_cost",
-      title: "额外费用"
+      field: "nottax_dept_cost",
+      format: "cutNumber",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 26,
+        group: "报价信息",
+        visible: true,
+        ishidden: false
+      },
+      title: "部门售价(不含税)"
     },
     {
-      field: "moneyrate",
-      title: "汇率"
+      field: "dept_cost",
+      format: "cutNumber",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 27,
+        group: "报价信息",
+        visible: true,
+        ishidden: false
+      },
+      title: "部门含税价"
     },
     {
-      field: "dscrp",
-      title: "备注"
+      field: "nottax_factory_cost",
+      format: "cutNumber",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 28,
+        group: "报价信息",
+        visible: true,
+        ishidden: false
+      },
+      title: "不含税出厂价"
     },
     {
       field: "costamt",
+      format: "cutNumber",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 29,
+        group: "报价信息",
+        visible: true,
+        ishidden: false
+      },
       title: "报价金额"
     },
     {
-      field: "nottax_factory_cost",
-      title: "不含税出厂价"
+      field: "bi_nottax_dept_cost",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 31,
+        group: "成本信息",
+        visible: true,
+        ishidden: false
+      },
+      title: "财务底价"
     },
     {
-      field: "nottax_dept_cost",
-      title: "部门售价(不含税)"
+      field: "total_material_cost",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 32,
+        group: "成本信息",
+        visible: true,
+        ishidden: false
+      },
+      title: "总材料成本"
     },
     {
-      field: "dept_cost",
-      title: "部门含税价"
+      field: "total_hr_cost",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 33,
+        group: "成本信息",
+        visible: true,
+        ishidden: false
+      },
+      title: "总人力成本"
     },
     {
-      field: "foreign_cost",
-      title: "外币价"
+      field: "total_cost",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 34,
+        group: "成本信息",
+        visible: true,
+        ishidden: false
+      },
+      title: "总成本"
+    },
+    {
+      field: "flag",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 30,
+        group: "其他",
+        visible: true,
+        ishidden: false
+      },
+      width: 44,
+      align: "center",
+      datatype: "checkbox",
+      title: "审核"
     },
     {
       field: "audit_date",
-      title: "审核日期"
+      format: "yyyy-MM-dd HH:mm",
+      width: 160,
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 31,
+        group: "其他",
+        visible: true,
+        ishidden: false
+      },
+      title: "审核日期",
+      colorder: 26
     },
     {
       field: "audit_emp",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 32,
+        group: "其他",
+        visible: true,
+        ishidden: false
+      },
       title: "审核人"
     },
     {
       field: "update_date",
+      format: "yyyy-MM-dd HH:mm",
+      width: 160,
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 33,
+        group: "其他",
+        visible: true,
+        ishidden: false
+      },
       title: "更新日期"
     },
     {
       field: "update_emp",
+      basicinfo: {
+        span: 1,
+        row: 1,
+        order: 34,
+        group: "其他",
+        visible: true,
+        ishidden: false
+      },
       title: "更新人"
     }
   ];
   // 明细表格配置项
-  const columnsMx: ColumnProps<any>[] = [];
-
+  const columnsMx: ColumnProps<any>[] = [
+    {
+      field: "printid",
+      title: "行号",
+      width: 50
+    },
+    {
+      field: "allow_edit",
+      title: "业务修改",
+      width: 80,
+      datatype: "checkbox"
+    },
+    {
+      field: "pzname",
+      title: "部件选配项",
+      visible: false
+    },
+    {
+      field: "pznamemx",
+      title: "部件选配项值",
+      visible: false
+    },
+    {
+      field: "mtrlcode",
+      title: "物料编码",
+      visible: false
+    },
+    {
+      field: "mtrlname",
+      title: "物料名称规格",
+      width: 400,
+      render: (scope: any) => {
+        return `${scope.row.mtrlname} ${scope.row.mtrlmode}`;
+      }
+    },
+    {
+      field: "unit",
+      title: "物料单位",
+      visible: false
+    },
+    {
+      field: "cutting_length",
+      title: "下料长(mm)",
+      datatype: "number"
+    },
+    {
+      field: "cutting_width",
+      title: "下料宽(mm)",
+      datatype: "number"
+    },
+    {
+      field: "cutting_qty",
+      title: "下料数量",
+      datatype: "number"
+    },
+    {
+      field: "useqty",
+      title: "理论用料量",
+      datatype: "number"
+    },
+    {
+      field: "use_formula",
+      title: "用料量公式"
+    },
+    {
+      field: "use_formula_str",
+      title: "用料量文本公式"
+    },
+    {
+      field: "actual_useqty",
+      title: "实际用量",
+      datatype: "number"
+    },
+    {
+      field: "loss_rate",
+      title: "损耗率",
+      datatype: "number"
+    },
+    {
+      field: "price",
+      title: "材料单价",
+      datatype: "number"
+    },
+    {
+      field: "price_formula",
+      title: "单价公式"
+    },
+    {
+      field: "price_formula_str",
+      title: "单价文本公式"
+    },
+    {
+      field: "cost_price",
+      title: "成本单价",
+      datatype: "number"
+    },
+    {
+      field: "cost_amt",
+      title: "成本金额",
+      datatype: "number"
+    }
+  ];
   /**
    * 详细页获取数据
    */
@@ -191,20 +782,146 @@ export const useHooks = (t?: any) => {
   };
 
   const detail_dataCallback = (data: any) => {
-    if (data.softbed && data.softbed.softbed_id > 0) {
-      state.softBed = [data.softbed];
+    if (state.orderStatus === "new") {
+      data.softbed.taxrate = 1;
     }
 
+    state.softBed = [data.softbed];
     state.softBedMx = data.mxList;
     state.headBoardMx = data.mxList.filter(item => item.has_type === 1);
     state.nightStandMx = data.mxList.filter(item => item.has_type === 2);
     state.bedFrameMx = data.mxList.filter(item => item.has_type === 4);
   };
 
+  /**
+   * 打开部件配置弹窗
+   */
+  const onOpenConfigureDialog = () => {};
+  /**
+   * 确认部件配置项值
+   * @param params 返回内容
+   */
+  const onConfirmConfigureDialog = (params: any) => {};
+  /**
+   * 保存报价
+   */
+  const onSave = () => {};
+  /**
+   * 审核报价
+   */
+  const onAudit = (list: any) => {
+    ElMessageBox.confirm("是否确定要审核单据吗?", "询问", {
+      confirmButtonText: "是",
+      cancelButtonText: "否",
+      type: "warning"
+    })
+      .then(() => {
+        AuditSoftBedQuote({ list, type: 1 }).then(() => {
+          ElMessage.success(t("sys.api.operationSuccess"));
+          state.VxeTableMxRef.refresh();
+        });
+      })
+      .catch((e: TypeError) => {
+        ElMessage({
+          type: "info",
+          message: "操作取消"
+        });
+      });
+  };
+  /**
+   * 撤审报价
+   */
+  const onCAudit = (list: any) => {
+    ElMessageBox.confirm("是否确定要撤审单据吗?", "询问", {
+      confirmButtonText: "是",
+      cancelButtonText: "否",
+      type: "warning"
+    })
+      .then(() => {
+        AuditSoftBedQuote({ list, type: 0 }).then(() => {
+          ElMessage.success(t("sys.api.operationSuccess"));
+          state.VxeTableMxRef.refresh();
+        });
+      })
+      .catch((e: TypeError) => {
+        ElMessage({
+          type: "info",
+          message: "操作取消"
+        });
+      });
+  };
+  /**
+   * 删除报价
+   */
+  const onDelete = (list: any, cb?: Function) => {
+    ElMessageBox.confirm(`是否确定要删除${list.length}张报价单吗?`, "询问", {
+      confirmButtonText: t("common.delText"),
+      cancelButtonText: "否",
+      type: "warning"
+    })
+      .then(() => {
+        DeleteSoftBedQuote({ list }).then(() => {
+          ElMessage.success(t("sys.api.operationSuccess"));
+          cb && cb();
+          state.VxeTableMxRef.refresh();
+        });
+      })
+      .catch((e: TypeError) => {
+        ElMessage({
+          type: "info",
+          message: "操作取消"
+        });
+      });
+  };
+  /**
+   * 复制报价
+   */
+  const onCopyQuote = () => {};
+  /**
+   * 显示公式
+   */
+  const onShowFormula = () => {};
+
+  const GetMoneyRateMapper = async () => {
+    return CommonDynamicSelect({ dsname: "_Mapper_if_moneyrate", queryparams: {} });
+  };
+  /**
+   * @description 获取部门汇率 和  折扣率
+   */
+  const wf_get_moneyrate_discount = (val: any) => {
+    const { _mainData, enumMap } = state.LjDetailRef;
+
+    let deptEnum = enumMap.get("deptid");
+    console.log("deptEnum :>> ", deptEnum);
+    if (deptEnum) {
+      let depItem = deptEnum.find((item: any) => item.deptid == _mainData.deptid);
+      if (depItem) {
+        let _moneyrate = !depItem.moneyrate || Number(depItem.moneyrate) == 0 ? 1 : depItem.moneyrate;
+        if (val == 0 || !_mainData.if_moneyrate) {
+          _mainData.if_moneyrate = 0;
+          _mainData.moneyrate = 1;
+        } else {
+          _mainData.moneyrate = _moneyrate;
+        }
+        _mainData.discount = depItem.discount;
+      }
+    }
+  };
+
+  const funcTaxrateChange = async (val: any, data) => {
+    data.taxrate = val;
+  };
+
   return {
     ...toRefs(state),
     columns,
     columnsMx,
-    detail_getData
+    detail_getData,
+    onSave,
+    onAudit,
+    onCAudit,
+    onDelete,
+    onCopyQuote,
+    onShowFormula
   };
 };

+ 11 - 78
JLHWEB/src/views/quote/softbedQuote/index.vue

@@ -36,7 +36,6 @@
 <script setup lang="ts" name="softbedQuote">
 import { ref, reactive } from "vue";
 import { useRouter } from "vue-router";
-import { AuditSoftBedQuote, DeleteSoftBedQuote } from "@/api/modules/quote";
 import { CommonDynamicSelect } from "@/api/modules/common";
 import { useHooks } from "./hooks/index";
 import LjHeaderMenu from "@/components/LjHeaderMenu/index.vue";
@@ -49,20 +48,16 @@ import { useGlobalStore } from "@/stores/modules/global";
 import { ElMessage, ElMessageBox } from "element-plus";
 import { detailAction } from "@/components/LjDetail/interface";
 import { useUserStore } from "@/stores/modules/user";
-import mittBus from "@/utils/mittBus";
-import { MittEnum } from "@/enums/mittEnum";
 import { getCurrentRecords } from "@/utils/index";
 import BedConfigModal from "./components/BedConfigModal.vue";
 
 const { t } = useI18n();
 const router = useRouter();
 const globalStore = useGlobalStore();
-const { columns, orderStatus, VxeTableRef } = useHooks();
+const { columns, orderStatus, VxeTableRef, initParams, onAudit, onCAudit, onDelete, onShowFormula } = useHooks();
 const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
 const { userInfo } = useUserStore();
 
-const initParams = ref({});
-
 const allConfigItemOptions = reactive([
   { pzid: 101, pzname: "颜色" },
   { pzid: 201, pzname: "材质" },
@@ -135,6 +130,7 @@ const dataCallback = (data: any) => {
 };
 
 const handleDBlClickTable = ({ row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event }: any) => {
+  //
   if (globalStore.detailBlank) {
     // 打开新的窗口
     const routeUrl = router.resolve({
@@ -226,23 +222,7 @@ const action: detailAction[] = [
         return { softbed_id: Number(item.softbed_id) };
       });
 
-      ElMessageBox.confirm(`是否确定要删除${curRecords.length}张报价单吗?`, "询问", {
-        confirmButtonText: t("common.delText"),
-        cancelButtonText: "否",
-        type: "warning"
-      })
-        .then(() => {
-          DeleteSoftBedQuote({ list }).then(() => {
-            ElMessage.success(t("sys.api.operationSuccess"));
-            VxeTableRef.value.refresh();
-          });
-        })
-        .catch((e: TypeError) => {
-          ElMessage({
-            type: "info",
-            message: "操作取消"
-          });
-        });
+      onDelete(list);
     }
   }),
   buttonDefault({
@@ -259,27 +239,10 @@ const action: detailAction[] = [
     },
     clickFunc: item => {
       const { curRecords } = getCurrentRecords(VxeTableRef.value);
-      ElMessageBox.confirm("是否确定要审核单据吗?", "询问", {
-        confirmButtonText: "是",
-        cancelButtonText: "否",
-        type: "warning"
-      })
-        .then(() => {
-          let list = curRecords.map((item: any) => {
-            return { softbed_id: Number(item.softbed_id) };
-          });
-
-          AuditSoftBedQuote({ list, type: 1 }).then(() => {
-            ElMessage.success(t("sys.api.operationSuccess"));
-            VxeTableRef.value.refresh();
-          });
-        })
-        .catch((e: TypeError) => {
-          ElMessage({
-            type: "info",
-            message: "操作取消"
-          });
-        });
+      let list = curRecords.map((item: any) => {
+        return { softbed_id: Number(item.softbed_id) };
+      });
+      onAudit(list);
     }
   }),
   buttonDefault({
@@ -296,27 +259,10 @@ const action: detailAction[] = [
     },
     clickFunc: item => {
       const { curRecords } = getCurrentRecords(VxeTableRef.value);
-      ElMessageBox.confirm("是否确定要撤审单据吗?", "询问", {
-        confirmButtonText: "是",
-        cancelButtonText: "否",
-        type: "warning"
-      })
-        .then(() => {
-          let list = curRecords.map((item: any) => {
-            return { softbed_id: Number(item.softbed_id) };
-          });
-
-          AuditSoftBedQuote({ list, type: 0 }).then(() => {
-            ElMessage.success(t("sys.api.operationSuccess"));
-            VxeTableRef.value.refresh();
-          });
-        })
-        .catch((e: TypeError) => {
-          ElMessage({
-            type: "info",
-            message: "操作取消"
-          });
-        });
+      let list = curRecords.map((item: any) => {
+        return { softbed_id: Number(item.softbed_id) };
+      });
+      onCAudit(list);
     }
   }),
   buttonDefault({
@@ -355,12 +301,6 @@ const action: detailAction[] = [
     label: t("common.dataTransmission"),
     power: 61,
     clickFunc: item => {}
-  }),
-  buttonDefault({
-    label: "测试弹窗",
-    clickFunc: item => {
-      isModalVisible.value = true;
-    }
   })
 ];
 
@@ -371,11 +311,4 @@ const handleConfirm = data => {
   console.log("showBedframe :>>", showBedframe);
   console.log("partsConfig :>>", data);
 };
-
-/**
- * @description 监听框架属性变化
- */
-mittBus.on(MittEnum.SoftBedList, () => {
-  VxeTableRef.value.refresh();
-});
 </script>