123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601 |
- <template>
- <div class="BidSystemProductDeOrderEdit">
- <Toptitle title="拆单页">
- <slot name="titleButton">
- <Button
- @click="handleFinish(0)"
- type="primary"
- style="margin-right: 10px"
- >取消完成</Button
- >
- <Button
- @click="handleFinish(1)"
- type="primary"
- style="margin-right: 10px"
- >完成</Button
- >
- <Button
- @click="showSupModal = true"
- type="primary"
- style="margin-right:10px;"
- >项目辅料</Button
- >
- <Button
- @click="goback()"
- type="primary"
- ghost
- style="margin-right:10px;"
- >返回</Button
- >
- <!-- <Button
- @click="postData()"
- type="primary"
- ghost
- style="margin-right:10px;"
- >保存</Button
- > -->
- </slot>
- </Toptitle>
- <div class="top_search_info">
- <Form inline :label-width="100">
- <FormItem label="产品名称:">
- <Input
- type="text"
- size="small"
- clearable
- v-model="searchData.title"
- placeholder="请输入产品名称"
- />
- </FormItem>
- <FormItem label="图号:">
- <Input
- type="text"
- size="small"
- clearable
- v-model="searchData.url_number"
- style="width: 150px"
- placeholder="请输入图号"
- />
- </FormItem>
- <FormItem label="是否完成:">
- <Select
- v-model="searchData.status"
- size="small"
- clearable
- filterable
- style="width: 150px"
- >
- <Option label="是" :value="1"></Option>
- <Option label="否" :value="0"></Option>
- </Select>
- </FormItem>
- <FormItem label="是否下生产:">
- <Select
- v-model="searchData.sub_state"
- size="small"
- clearable
- filterable
- style="width: 150px"
- >
- <Option label="是" :value="2"></Option>
- <Option label="否" :value="1"></Option>
- </Select>
- </FormItem>
- <FormItem>
- <Button
- size="small"
- type="primary"
- @click="
- initData(
- formData.order_no,
- formData.orders_area_product_detail_id
- )
- "
- >搜索</Button
- >
- </FormItem>
- </Form>
- </div>
- <div class="top_search">
- <div><span>订单号:</span>{{ formData.order_no }}</div>
- <div><span>项目名称:</span>{{ formData.residential_name }}</div>
- <div><span>客户姓名:</span>{{ formData.client_name }}</div>
- <div>
- <span>紧急程度:</span
- ><span
- v-for="_item in warningList"
- :key="_item.id"
- v-show="_item.id == formData.warning_state"
- >{{ _item.title }}</span
- >
- </div>
- <div>
- <span>收款:</span>{{ formData.pay_state == 1 ? "已收款" : "未收款" }}
- </div>
- <div><span>详细地址:</span>{{ formData.address }}</div>
- <div><span>手机号:</span>{{ formData.mobile }}</div>
- <div>
- <span>开始日期:</span>{{ func.replaceDate(formData.start_time) }}
- </div>
- <div><span>交付日期:</span>{{ func.replaceDate(formData.end_time) }}</div>
- <div>
- <span>业务员:</span>
- <span
- v-for="item in salesmanList"
- :key="item.id"
- v-show="formData.salesman == item.id"
- >{{ formData.salesman }}</span
- >
- </div>
- <!-- <div><span>订单类型:</span>{{formData.renovation_type==1?"工装":"家装"}}</div> -->
- <div><span>备注:</span>{{ formData.remark }}</div>
- </div>
- <div class="addArea">
- <div class="addAreaTable">
- <Table
- :columns="tableColumns"
- :data="formData.detail"
- border
- @on-selection-change="changeSelection"
- >
- <template slot="set" slot-scope="{ row, index }">
- <a
- :disabled="row.explode_status != 0"
- style="margin:0 5px"
- @click="handleSet(row, index, 1)"
- >拆单</a
- >
- <a style="margin:0 5px" @click="handleSet(row, index, 2)">详情</a>
- </template>
- </Table>
- </div>
- </div>
- <!-- 项目辅料弹窗 -->
- <Modal title="项目辅料" v-model="showSupModal" :width="400">
- <div>
- <div class="supModalBtn">
- <!-- <Button @click="handleAddSup" type="primary">新增</Button> -->
- </div>
- <Table :columns="supTableColumns" :data="supTableData" border>
- <template slot="combine" slot-scope="{ index }">
- <Select
- v-model="supTableData[index].id"
- @on-change="handlechange"
- transfer
- size="small"
- >
- <Option
- v-for="item in combineList"
- :value="item.id"
- :key="item.id"
- :label="item.title"
- ></Option>
- </Select>
- </template>
- <template slot="supSet" slot-scope="{ row, index }">
- <a
- style="margin: 0 5px; color: red"
- v-show="$route.query.type != 3"
- @click="handleSupSet(row, index)"
- >删除</a
- >
- </template>
- </Table>
- </div>
- <div class="modal-footer" slot="footer">
- <Button @click="showSupModal = false">取消</Button>
- <Button type="primary" @click="showSupModal = false">确认</Button>
- </div>
- </Modal>
- </div>
- </template>
- <script>
- // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
- // 例如:import 《组件名称》 from '《组件路径》';
- export default {
- name: "BidSystemProductDeOrderEdit",
- components: {},
- props: {},
- // import引入的组件需要注入到对象中才能使用
- data() {
- // 这里存放数据
- return {
- selection_check: "",
- detail_id: [],
- showSupModal: false,
- showPDTModal: false,
- formData: {
- order_no: "",
- orders_area_product_detail_id: "",
- residential_name: "",
- client_name: "",
- address: "",
- mobile: "",
- pay_state: "",
- warning_state: "",
- salesman: "",
- remark: "",
- //区域列表
- area: [
- {
- num: "",
- title: "",
- unit: "",
- quantity: "",
- house_type: "",
- remark: "",
- order_no: "",
- product: [
- // {
- // title:'',
- // num:'',
- // measure:'',
- // process_property:'',
- // url:'',
- // url_number:'',
- // remark:''
- // }
- ],
- },
- ],
- },
- product: [{}],
- searchData: {},
- tableColumns: [
- {
- type: "selection",
- width: 60,
- align: "center",
- },
- {
- title: "序号",
- type: "index",
- align: "center",
- minWidth: 80,
- resizable: true,
- },
- {
- title: "产品名称",
- key: "title",
- align: "center",
- minWidth: 120,
- resizable: true,
- },
- {
- title: "计量单位",
- key: "unit",
- align: "center",
- minWidth: 100,
- resizable: true,
- },
- {
- title: "图号",
- key: "url_number",
- align: "center",
- minWidth: 80,
- resizable: true,
- },
- {
- title: "数量",
- key: "num",
- align: "center",
- minWidth: 80,
- resizable: true,
- },
- {
- title: "规格",
- key: "measure",
- align: "center",
- minWidth: 140,
- resizable: true,
- },
- {
- title: "工艺属性",
- key: "process_property",
- align: "center",
- minWidth: 140,
- resizable: true,
- tooltip: true,
- },
- {
- title: "图纸",
- key: "url",
- align: "center",
- resizable: true,
- minWidth: 80,
- render: (h, params) => {
- const { row } = params;
- return h(
- "div",
- row.url.map((item, index) => {
- return h("img", {
- attrs: {
- src: this.$store.state.ip + item,
- style:
- "max-width:50px;max-height:50px;position:relative;top:3px;",
- },
- on: {
- click: (e) => {
- // this.axios('/api/orders_img', { params: { id: row.id, type: 1 } }).then(res => {
- // if (res.code == 200) {
- // row.imgs = res.data
- let list = [];
- row.url.forEach((el) => {
- list.push({ img_url: el });
- });
- this.$previewImg({
- list,
- baseUrl: this.$store.state.ip,
- baseImgField: "img_url",
- baseTitleField: "",
- });
- // }
- // })
- },
- },
- });
- })
- );
- },
- },
- {
- title: "左右式",
- key: "left_right_mode",
- align: "center",
- resizable: true,
- minWidth: 80,
- render: (h, params) => {
- const { row } = params;
- return h(
- "span",
- {},
- row.left_right_mode == 1
- ? "左式"
- : row.left_right_mode == 2
- ? "右式"
- : "无"
- );
- },
- },
- {
- title: "拆单状态",
- key: "status",
- align: "center",
- resizable: true,
- minWidth: 80,
- render: (h, params) => {
- const { row } = params;
- return h("span", {}, row.explode_status == 0 ? "未完成" : "已完成");
- },
- },
- {
- title: "是否下生产",
- key: "",
- align: "center",
- resizable: true,
- width: 80,
- render: (h, params) => {
- return h("span", {}, params.row.status == 0 ? "否" : "是");
- },
- },
- {
- title: "操作",
- key: "name",
- align: "center",
- width: "120",
- slot: "set",
- minWidth: 80,
- // fixed: "right",
- resizable: true,
- },
- ],
- //产品分类列表
- PDTTypeList: [],
- //业务员列表
- salesmanList: [],
- warningList: [],
- supTableColumns: [
- { title: "序号", type: "index", align: "center", minWidth: 100 },
- {
- title: "辅料名称",
- key: "title",
- align: "center",
- slot: "combine",
- minWidth: 150,
- },
- { title: "操作", align: "center", slot: "supSet", minWidth: 100 },
- ],
- supTableData: [], //项目辅料→辅料名称列表
- combineList: [], //项目辅料列表
- };
- },
- // 生命周期 - 创建完成(可以访问当前this实例)
- created() {
- // 获取项目辅料列表
- this.axios("/api/material_combination").then((res) => {
- this.combineList = res.data.data;
- });
- // 2编辑 3详情 4变更 5变更记录
- this.$route.query.type == 3 ? (this.isChecked = true) : "";
- this.$route.query.order_no
- ? (this.formData.order_no = this.$route.query.order_no)
- : "";
- this.$route.query.orders_area_product_detail_id
- ? (this.formData.orders_area_product_detail_id = this.$route.query.orders_area_product_detail_id)
- : "";
- // 获取紧急程度
- this.axios.get("/api/warning_list").then((res) => {
- this.warningList = res.data.data;
- });
- // 获取项目辅料
- // this.axios
- // .get("/api/todo", { params: { order_no: this.formData.order_no } })
- // .then((res) => {
- // this.supTableData = res.data
- // });
- },
- // 生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- this.axios("/api/user").then((res) => (this.salesmanList = res.data.data));
- this.axios("/api/parts_product_list").then((res) => {
- this.PDTTypeList = res.data;
- });
- this.initData(
- this.formData.order_no,
- this.formData.orders_area_product_detail_id
- );
- },
- methods: {
- changeSelection(e) {
- this.selection_check = e;
- e.forEach((item) => {
- this.detail_id.push(item.id);
- });
- },
- handleFinish(status) {
- if (this.selection_check.length == 0) {
- this.$Message.warning("请选择数据");
- } else {
- this.$Modal.confirm({
- title: "确认完成?",
- // content: "此操作确认后不可恢复,请确认!",
- onOk: () => {
- this.axios({
- method: "post",
- url: "/api/order_area_product_status",
- data: {
- status,
- orders_area_product_detail_id: this.detail_id,
- },
- }).then((res) => {
- if (res.code == 200) {
- this.$Message.success(res.msg);
- this.initData(
- this.formData.order_no,
- this.formData.orders_area_product_detail_id
- );
- }
- });
- },
- onCancel: () => {
- console.log(this.$refs.selection);
- },
- });
- }
- },
- //项目辅料新增
- handleAddSup() {
- this.supTableData.push({ id: "" });
- },
- //项目辅料删除
- handleSupSet(row, index) {
- this.supTableData.splice(index, 1);
- },
- handlechange(val) {
- console.log("val :>> ", val);
- },
- initData(order_no, orders_area_product_detail_id) {
- this.axios({
- method: "get",
- url: "/api/order_area_explode",
- params: {
- order_no,
- oa_id: this.$route.query.oa_id,
- ...this.searchData,
- },
- }).then((res) => {
- this.formData = res.data;
- this.supTableData = res.data.ext;
- // this.formData.list.forEach((element) => {
- // element.product.forEach((el, index) => {
- // el.index = index + 1;
- // });
- // });
- });
- },
- // 1拆单 2详情
- handleSet(row, index, type) {
- this.$router.push({
- path: "/cms/BidSystem/ProductDeOrder/deorderdetail",
- query: {
- type,
- order_no: this.$route.query.order_no,
- oa_id: this.$route.query.oa_id,
- orders_area_product_detail_id: row.id,
- },
- });
- },
- postData() {
- this.axios({
- method: "post",
- url: "/api/order_area_add",
- data: {
- ...this.formData,
- },
- }).then((res) => {
- this.$Message.success(res.msg);
- });
- },
- goback() {
- this.$router.go(-1);
- },
- },
- // 监听属性 类似于data概念
- computed: {},
- // 监控data中的数据变化
- watch: {},
- beforeCreate() {}, // 生命周期 - 创建之前
- beforeMount() {}, // 生命周期 - 挂载之前
- beforeUpdate() {}, // 生命周期 - 更新之前
- updated() {}, // 生命周期 - 更新之后
- beforeDestroy() {}, // 生命周期 - 销毁之前
- destroyed() {}, // 生命周期 - 销毁完成
- activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
- };
- </script>
- <style lang="scss" scoped>
- .BidSystemProductDeOrderEdit {
- overflow: hidden;
- overflow-y: auto;
- .top_search {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- flex-wrap: wrap;
- width: 100%;
- padding: 10px 0;
- font-size: 14px;
- div {
- width: 200px;
- padding: 5px;
- }
- }
- .addArea {
- .addAreaTable {
- padding: 20px 0;
- }
- position: relative;
- padding: 15px;
- margin-bottom: 30px;
- border-radius: 5px;
- box-shadow: 1px 1px 5px 1px #999;
- .addAreaBtn {
- position: absolute;
- right: 20px;
- top: 20px;
- }
- /deep/ .ivu-form-item {
- display: inline-block;
- width: 220px;
- }
- }
- }
- .supModalBtn {
- display: flex;
- justify-content: flex-end;
- margin-bottom: 10px;
- }
- </style>
|