获取纤度登记表列表的接口联调和字段调试+获取纤度登记表的详情接口联调字段调试+删纤度登记表的接口联调
3个文件已修改
315 ■■■■■ 已修改文件
src/api/productManage/silkRegisterForm.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productManage/silkRegisterForm/addPage.vue 240 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productManage/silkRegisterForm/index.vue 57 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/productManage/silkRegisterForm.js
@@ -1,5 +1,4 @@
import request from "@/common/untils/request.js"
// 纤度登记列表 
export function getRegisterList(data) {
  return request({
@@ -8,11 +7,20 @@
    data
  })
}
//保存纤度登记
export function saveRegister(data) {
  return request({
    url: "/api-jl/v1/fineness/register",
    method: "post",
    data
  })
}
// 纤度登记表的详情
export function getRegisterDetails(data) {
  return request({
    url: "/api-jl/v1/fineness/register/"+data.id,
    method: "get",
    data
  })
}
@@ -32,6 +40,14 @@
    data
  })
}
// 纤度登记表 组别的数据
export function getWorkshopManageList(data) {
  return request({
    url: "/api-jl/v1/system/getWorkshopManageList",
    method: "get",
    data
  })
}
// 更新跟进记录
export function getUpdateFollowRecord(data) {
  return request({
src/views/productManage/silkRegisterForm/addPage.vue
@@ -13,7 +13,7 @@
                        placeholder="请输入关键词" @searchClick="onFilterSearch">
                        <template slot="leftButton">
                            <el-button size="small" type="primary" @click="cancelClickOne">放弃</el-button>
                            <el-button size="small" type="primary" @click="saveClickOne('form')">保存</el-button>
                            <el-button size="small" type="primary" :loading="isAddloading"  @click="saveClickOne('form')">保存</el-button>
                        </template>
                    </CommonSearch>
                </div>
@@ -47,13 +47,13 @@
                            </el-select>
                        </el-form-item>
                        <el-form-item label="规格" prop="spec" class="form-item">
                            <el-input v-model="form.spec" placeholder="请输入">
                            </el-input>
                            <!-- <el-select v-model="form.spec" placeholder="请选择" class="select-width">
                                <el-option v-for="item in deliveryTypeList" :key="item.id" :label="item.name"
                                    :value="item.id">
                            <el-select v-model="form.spec" placeholder="请选择" class="select-width">
                                <el-option v-for="item in specList" :key="item.ID" :label="item.name"
                                    :value="item.name">
                                </el-option>
                            </el-select> -->
                            </el-select>
                            <!-- <el-input v-model="form.spec" placeholder="请输入">
                            </el-input> -->
                        </el-form-item>
                        <el-form-item label="组别" prop="workshopGroup" class="form-item">
                            <el-select v-model="form.workshopGroup" placeholder="请选择" class="select-width">
@@ -86,9 +86,20 @@
                        </el-form-item>
                    </el-form>
                    <div class="list-view">
                        <TableCommonView ref="tableListRef" :colOpenShow="false" v-loading="loading" :table-list="tableList"
                        <!-- <TableCommonView ref="tableListRef" :colOpenShow="false" v-loading="loading" :table-list="tableList"
                            @selTableCol="selTableCol">
                        </TableCommonView>
                        </TableCommonView> -->
                        <!-- 修改为输入 -->
                        <CommonFormTableView
                        ref="commonFormTableView"
                        :detail-enter="isView ? true : false"
                        :selectBox="false"
                        :detailEnter="true"
                        :show-summary="showSummary"
                        :product-table-list="tableList"
                        @inputContent="inputContent"
                        @addProductClick="addProductClick"
                        ></CommonFormTableView>
                    </div>
                </div>
                <div class="body-r">
@@ -98,24 +109,24 @@
            </div>
        </template>
        <template v-if="activeName == 'second'">
            <!-- <div class="body-two body" v-if="activeName == 'second'">
            <div class="body-two body" v-if="activeName == 'second'">
                <div class="body-two-t">纤度检验表</div>
                <el-form ref="form" class="form-box" :model="form" :rules="rules" label-position="right" label-width="60px">
                    <div class="form-box-t">
                        <el-form-item label="编号" prop="clientName" class="form-item">
                            1234546677
                        </el-form-item>
                        <el-form-item label="车间" prop="deliverType" class="form-item">
                            <el-select v-model="form.deliverType" placeholder="请选择">
                                <el-option v-for="item in deliveryTypeList" :key="item.id" :label="item.name"
                                    :value="item.id">
                        <el-form-item label="车间" prop="name" class="form-item">
                            <el-select v-model="form.name" placeholder="请选择" class="select-width">
                                <el-option v-for="item in nameList" :key="item.ID" :label="item.name"
                                    :value="item.name">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="组别" prop="deliverType" class="form-item">
                            <el-select v-model="form.deliverType" placeholder="请选择" style="width: 100%">
                                <el-option v-for="item in deliveryTypeList" :key="item.id" :label="item.name"
                                    :value="item.id">
                        <el-form-item label="组别" prop="workshopGroup" class="form-item">
                            <el-select v-model="form.workshopGroup" placeholder="请选择" class="select-width">
                                <el-option v-for="item in workshopGroupList" :key="item.ID" :label="item.name"
                                    :value="item.ID">
                                </el-option>
                            </el-select>
                        </el-form-item>
@@ -123,9 +134,14 @@
                            <el-input v-model.number="form.amount" placeholder="请输入" show-word-limit
                                style="width: 100%"></el-input>
                        </el-form-item>
                        <el-form-item label="规格" prop="clientName" class="form-item">
                            <el-input v-model="form.clientName" placeholder="请输入">
                            </el-input>
                        <el-form-item label="规格" prop="spec" class="form-item">
                            <el-select v-model="form.spec" placeholder="请选择" style="width: 100%">
                                <el-option v-for="item in specList" :key="item.id" :label="item.name"
                                    :value="item.id">
                                </el-option>
                            </el-select>
                            <!-- <el-input v-model="form.spec" placeholder="请输入">
                            </el-input> -->
                        </el-form-item>
                        <el-form-item label="日期" prop="signTime" class="form-item">
                            <el-date-picker v-model="form.signTime" value-format="yyyy-MM-dd" type="date" placeholder="选择日期"
@@ -223,40 +239,35 @@
                        </el-form-item>
                    </div>
                </el-form>
            </div> -->
            </div>
        </template>
    </div>
</template>
  
<script>
import { getRegisterList,saveRegister,getDictList } from "@/api/productManage/silkRegisterForm.js"
import { getRegisterList,saveRegister,getDictList,getWorkshopManageList,getRegisterDetails } from "@/api/productManage/silkRegisterForm.js"
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
import CommonFormTableView from "@/components/makepager/CommonFormTableView"
export default {
    name: "silkRegisterAddPage",
    props: {},
    mixins: [pageMixin],
    components: {
        CommonFormTableView,
    },
    computed: {},
    data() {
        return {
            tableList: {},
            loading: false,
            activeName: "first",
            searchOptions: [],
            search_map: {},
            is_public: true,
            tableColumn: [
                { label: "车号", prop: "position", min: 100, default: true }, // 客户名称
                { label: "纤度值", prop: "fineness", default: true }, // 销售负责人
                { label: "数量", prop: "quantity", default: true }, // 重要级别
                { label: "纤度合计", prop: "sum", min: 90, default: true }, // 下次回访日期
            ],
            showCol: ['车号', '纤度值', '数量', '纤度合计'],
            marketList:[], //庄口
            nameList:[], //车间
            workshopGroupList:[], //组别
            deliveryTypeList: [],
            specList:[], //规格
            form: {
                number:'',
                finishDate:'',
@@ -276,14 +287,16 @@
                finishDate: [
                    { required: true, message: "请选择", trigger: ["change", 'blur'] },
                ],
                // 车间 应该true
                name: [
                    { required: true, message: "请选择", trigger: ["change", 'blur'] },
                ],
                spec: [
                    { required: true, message: "请填写", trigger: ["change", 'blur'] },
                ],
                // 组别 应该true
                workshopGroup: [
                    { required: true, message: "请选择", trigger: ["change", 'blur'] },
                    { required: false, message: "请选择", trigger: ["change", 'blur'] },
                ],
                circle: [
                    { required: true, message: "请填写", trigger: ["change", 'blur'] },
@@ -333,41 +346,94 @@
                    { label: "26.5", prop: "next_visit_time", min: 90, default: true },
                ],
            },
            // 新增纤度登记表
            isAddloading:false,
            isView: true,
            showSummary: {
                show: true,
                total: true,
                totalLabel:'合计:',
                sumProp: ["fineness", "quantity",'sum'],
                mergeNumber: 0
            },
            productId: 1,
            tableList: {
                allcol: [],
                headerColor:'red',
                showcol: ['车号', '纤度值', '数量', '纤度合计'],
                tableData: [
                    {
                        productId:1,
                        position: '',
                        fineness: 0,
                        quantity: 0,
                        sum: "",
                    }
                ],
                tableColumn:[
                    { label: "车号", prop: "position", input: true }, // 客户名称
                    { label: "纤度值", prop: "fineness", inputNumber: true, isRequird: true, }, // 销售负责人
                    { label: "数量", prop: "quantity", inputNumber: true , isRequird: true,}, // 重要级别
                    { label: "纤度合计", prop: "sum", inputNumber: true}, // 下次回访日期
                ],
            },
            tableData:[],
            registerId:'',
        }
    },
    created() {
        let query = this.$route.query;
        if (query) {
            this.activeName = query.activeName ? query.activeName : "first";
            this.registerId= query.id ? query.id : "";
        }
        this.setTable()
        this.getSelectDataList()
        this.search_map = {
            is_public: this.is_public
        }
        this.getDetailsData()
        this.getData()
    },
    methods: {
        getDetailsData(){
            if(this.registerId){
                getRegisterDetails({ id: this.registerId }).then((response) => {
                    if (response.code === 200) {
                    let config=JSON.parse(JSON.stringify(response.data?response.data:{}));
                    this.form=config;
                    this.tableList.tableData=config.finenessList?config.finenessList:[]
                    this.tableData=config.finenessList?config.finenessList:[]
                    }
                })
            }
        },
        getSelectDataList(){
            //车间
            getDictList({
                dictType: 0,
                dictType: 1,
            }).then((res) => {
                    if (res.code == 200) {
                        this.nameList=res.data||[]
                    }
                })
                //组别
            getDictList({
                dictType: 1,
                 //规格
                 getDictList({
                dictType: 3,
            }).then((res) => {
                    if (res.code == 200) {
                        this.specList=res.data||[]
                    }
                })
                //组别
                getWorkshopManageList().then((res) => {
                    if (res.code == 200) {
                        this.workshopGroupList=res.data||[]
                    }
                })
                //庄口
                getDictList({
                dictType: 2,
                dictType: 0,
            }).then((res) => {
                    if (res.code == 200) {
                        this.marketList=res.data||[]
@@ -376,37 +442,30 @@
        },
        inputStart(){
            this.form.circle=this.form.startCircle+'-'+this.form.endCircle
        },
        setTable() {
            this.tableList = {
                selectIndex: false,
                headerColor: 'red',
                tableInfomation: [],
                allcol: [],
                showcol: this.showCol,
                tableColumn: this.setColumnVisible(this.showCol)
            }
            this.tableList.allcol = this.tableList.tableColumn.filter(ele => !ele.default).map(ele => ele.label);
            this.searchOptions = []
            for (let i = 0; i < this.tableList.tableColumn.length; i++) {
                const label = this.tableList.tableColumn[i].label
                const value = this.tableList.tableColumn[i].prop
                this.searchOptions.push({ value: value, label: label })
            }
        },
        // 产品新增
        addProductClick() {
            this.productId++
            this.tableData.push({
                productId: this.productId,
                position: '',
                        fineness: 0,
                        quantity: 0,
                        sum: "",
            })
            this.tableList.tableData=this.tableData
            this.showSummary.show = true
        },
        setColumnVisible(showCol) {
            return this.tableColumn.map(ele => {
                return {
                    ...ele,
                    isShowColumn: showCol.includes(ele.label)
         // 产品列表输入
        inputContent(val, prop, row) {
            this.productId = row.productId
            this.tableData.map((item) => {
                if (item.productId === row.productId) {
                    item[prop] = val
                }
            })
        },
        selTableCol(val) {
            this.showcol = val;
            this.tableList.tableColumn = this.setColumnVisible(val);
        },
        // 请求数据
        },
            // 请求数据
        async getData() {
            this.loading = true
            await getRegisterList({
@@ -450,21 +509,18 @@
                                    position: position
                                }
                            })
                            this.tableList.tableInfomation = list || []
                            this.tableTwoList.tableInfomation = []
                            this.tableTwoList.tableInfomation =list|| []
                            this.pagerOptions.totalCount = res.data.count
                        } else {
                            this.tableList.tableInfomation = []
                            this.tableTwoList.tableInfomation = []
                        }
                    } else {
                        this.tableList.tableInfomation = []
                        this.tableTwoList.tableInfomation = []
                    }
                    this.loading = false
                })
                .catch((err) => {
                    console.log(err)
                    this.tableList.tableInfomation = []
                    this.loading = false
                })
        },
@@ -493,7 +549,29 @@
        // 纤度登记表
        // 放弃
        cancelClickOne() {
            if(this.activeName == 'first'){
                this.form={
                    number:'',
                    finishDate:'',
                    market:'',
                    name:'',
                    spec:'',
                    workshopGroup:'',
                    circle:'',
                    startCircle:'',
                    endCircle:'',
                    position:'',
                }
                this.$refs.form.resetFields();
                this.productId=1
                this.tableList.tableData=[{
                    productId:1,
                        position: '',
                        fineness: 0,
                        quantity: 0,
                        sum: "",
                }]
            }
        },
        // 保存
        saveClickOne(formName) {
@@ -501,10 +579,15 @@
                if (valid) {
                    let form = JSON.parse(JSON.stringify(this.form));
                    delete form.circle
                    let finenessList= JSON.parse(JSON.stringify(this.tableList.tableData));
                    for(let i in finenessList){
                        delete finenessList[i].productId
                    }
                    let params = {
                        finenessList: this.tableList.tableInfomation,
                        finenessList:finenessList,
                        ...form
                    }
                    this.isAddloading=true
                    saveRegister(params).then((res) => {
                        if (res.code == 200) {
                            this.$message({
@@ -512,9 +595,15 @@
                                type: "success",
                            });
                        }
                    });
                        this.isAddloading=false
                    }).catch(() => {
                        setTimeout(() => {
                            this.isAddloading = false;
                            }, 3000);
                    })
                } else {
                    console.log('error submit!!');
                    return false;
                }
            });
@@ -570,7 +659,7 @@
        box-sizing: border-box;
        padding: 10px 10px;
        border-radius: 12px;
        height: calc(100% - 139px - 10px);
        height: calc(100% - 139px - 10px - 20px);
        width: calc(100% - 20px);
        margin: 0 auto;
        margin-top: 10px;
@@ -613,6 +702,7 @@
            .list-view {
                height: calc(100% - 0px);
                min-height:200px;
                overflow: hidden;
            }
        }
src/views/productManage/silkRegisterForm/index.vue
@@ -30,8 +30,8 @@
            <template slot="tableButton">
              <el-table-column label="操作" width="90" fixed="right">
                <template slot-scope="scope">
                  <el-button @click="handleClick(scope.row)" type="text" size="small">编辑</el-button>
                  <el-button @click="delClick(scope.row.id)" type="text" size="small">删除</el-button>
                  <el-button @click="handleClick(scope.row)" type="text" size="small">修改</el-button>
                  <el-button @click="delClick(scope.row.ID)" type="text" size="small">删除</el-button>
                </template>
              </el-table-column>
            </template>
@@ -46,7 +46,7 @@
</template>
<script>
import { getRegisterList, getDeleteRegister } from "@/api/productManage/silkRegisterForm.js"
import { getRegisterList,getDeleteRegister } from "@/api/productManage/silkRegisterForm.js"
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
export default {
@@ -61,11 +61,6 @@
      tableList: {},
      loading: false,
      searchOptions: [],
      editConfig: {
        visible: false,
        title: "新建",
        infomation: {}
      },
      search_map: {},
      tableColumn: [
        { label: "编号", prop: "number", min: 120, default: true }, // 主题
@@ -135,20 +130,20 @@
        .then((res) => {
          console.log(res)
          if (res.code === 200) {
            if (res.data.list && res.data.list.length > 0) {
              const list = res.data.list.map((item) => {
                return {
                  ...item,
                  client_name: item.client.name,
                  contact_name: item.contact.name,
                  client_status: item.client_status.name,
                  phone: item.contact.phone,
                  member_name: item.member.username,
                  contact_information_name: item.contact_information.name
                }
              })
              this.tableList.tableInfomation = list || []
              this.pagerOptions.totalCount = res.data.count
            if (res.data && res.data.length > 0) {
              // const list = res.data.map((item) => {
              //   return {
              //     ...item,
              //     client_name: item.client.name,
              //     contact_name: item.contact.name,
              //     client_status: item.client_status.name,
              //     phone: item.contact.phone,
              //     member_name: item.member.username,
              //     contact_information_name: item.contact_information.name
              //   }
              // })
              this.tableList.tableInfomation =  res.data || []
              this.pagerOptions.totalCount = res.count
            } else {
              this.tableList.tableInfomation = []
            }
@@ -181,23 +176,23 @@
    },
    // 编辑
    handleClick(row) {
      console.log(row)
      this.editConfig.title = "编辑"
      let config=JSON.parse(JSON.stringify(row));
      config.client_status_id=config.client_status_id?config.client_status_id:null
      config.contact_information_id=config.contact_information_id?config.contact_information_id:null
      this.editConfig.infomation = { ...config, sale_chance_name:row.sale_chance.name, sales_leads_name: "" }
      this.editConfig.visible = true
      this.$router.push({
                path:"/productManage/silkRegisterForm/addPage",
                query:{
                  id:row.ID,
                  activeName:'first'
                }
              });
    },
    // 删除
    delClick(id) {
      this.$confirm("是否确认删除?", "警告", {
      this.$confirm("请确认是否删除,删除操作不可撤销?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          getDeleteRegister({ ids: id }).then((response) => {
          getDeleteRegister({ id: id }).then((response) => {
            if (response.code === 200) {
              this.$message.success("删除成功")
              this.getData()